Skip to content

Commit 5d5d88e

Browse files
Tests: Add ssl-session-* config values tests. (#13745)
Co-authored-by: marcel2012 <[email protected]>
1 parent 6e933f2 commit 5d5d88e

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package settings
18+
19+
import (
20+
"strings"
21+
22+
"github.com/onsi/ginkgo/v2"
23+
24+
"k8s.io/ingress-nginx/test/e2e/framework"
25+
)
26+
27+
var _ = framework.DescribeSetting("ssl-session-cache", func() {
28+
f := framework.NewDefaultFramework("ssl-session-cache")
29+
30+
ginkgo.It("should have default ssl_session_cache and ssl_session_timeout values", func() {
31+
f.WaitForNginxConfiguration(func(cfg string) bool {
32+
return strings.Contains(cfg, "ssl_session_cache shared:SSL:10m;") &&
33+
strings.Contains(cfg, "ssl_session_timeout 10m;")
34+
})
35+
})
36+
37+
ginkgo.It("should disable ssl_session_cache", func() {
38+
f.UpdateNginxConfigMapData("ssl-session-cache", "false")
39+
40+
f.WaitForNginxConfiguration(func(cfg string) bool {
41+
return !strings.Contains(cfg, "ssl_session_cache")
42+
})
43+
})
44+
45+
ginkgo.It("should set ssl_session_cache value", func() {
46+
f.UpdateNginxConfigMapData("ssl-session-cache-size", "20m")
47+
48+
f.WaitForNginxConfiguration(func(cfg string) bool {
49+
return strings.Contains(cfg, "ssl_session_cache shared:SSL:20m;")
50+
})
51+
})
52+
53+
ginkgo.It("should set ssl_session_timeout value", func() {
54+
f.UpdateNginxConfigMapData("ssl-session-timeout", "30m")
55+
56+
f.WaitForNginxConfiguration(func(cfg string) bool {
57+
return strings.Contains(cfg, "ssl_session_timeout 30m;")
58+
})
59+
})
60+
})
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package settings
18+
19+
import (
20+
"strings"
21+
22+
"github.com/onsi/ginkgo/v2"
23+
24+
"k8s.io/ingress-nginx/test/e2e/framework"
25+
)
26+
27+
var _ = framework.DescribeSetting("ssl-session-tickets", func() {
28+
f := framework.NewDefaultFramework("ssl-session-tickets")
29+
30+
ginkgo.It("should have default ssl_session_tickets value", func() {
31+
f.WaitForNginxConfiguration(func(cfg string) bool {
32+
return strings.Contains(cfg, "ssl_session_tickets off;")
33+
})
34+
})
35+
36+
ginkgo.It("should set ssl_session_tickets value", func() {
37+
f.UpdateNginxConfigMapData("ssl-session-tickets", "true")
38+
39+
f.WaitForNginxConfiguration(func(cfg string) bool {
40+
return strings.Contains(cfg, "ssl_session_tickets on;")
41+
})
42+
})
43+
44+
ginkgo.It("should set ssl_session_tickets and ssl_session_ticket_key values", func() {
45+
f.UpdateNginxConfigMapData("ssl-session-tickets", "true")
46+
f.UpdateNginxConfigMapData("ssl-session-ticket-key", "WW9gcPHgfcrw6DNqY5VE2NjM6gtgUhJ4Vn6ZwRGi/7+A9TNFa4Fvfe1cmlPec9bxDoenN70aMBeZBlcrKshnKT4WJxFNLCuTHhfn4loTOEo=")
47+
48+
f.WaitForNginxConfiguration(func(cfg string) bool {
49+
return strings.Contains(cfg, "ssl_session_tickets on;") &&
50+
strings.Contains(cfg, "ssl_session_ticket_key /etc/ingress-controller/tickets.key;")
51+
})
52+
})
53+
})

0 commit comments

Comments
 (0)