@@ -26,21 +26,25 @@ import (
26
26
)
27
27
28
28
var _ = framework .DescribeAnnotation ("configuration-snippet" , func () {
29
- f := framework .NewDefaultFramework ("configurationsnippet" )
29
+ f := framework .NewDefaultFramework (
30
+ "configurationsnippet" ,
31
+ framework .WithHTTPBunEnabled (),
32
+ )
30
33
31
- ginkgo .BeforeEach (func () {
32
- f .NewEchoDeployment ()
33
- })
34
-
35
- ginkgo .It (`set snippet "more_set_headers "Foo1: Bar1";" in all locations"` , func () {
34
+ ginkgo .It ("set snippet more_set_headers in all locations" , func () {
36
35
host := "configurationsnippet.foo.com"
37
36
annotations := map [string ]string {
38
- "nginx.ingress.kubernetes.io/configuration-snippet" : `
39
- more_set_headers "Foo1: Bar1";` ,
37
+ "nginx.ingress.kubernetes.io/configuration-snippet" : `more_set_headers "Foo1: Bar1";` ,
40
38
}
41
39
42
- ing := framework .NewSingleIngress (host , "/" , host , f .Namespace , framework .EchoService , 80 , annotations )
43
- f .EnsureIngress (ing )
40
+ f .EnsureIngress (framework .NewSingleIngress (
41
+ host ,
42
+ "/" ,
43
+ host ,
44
+ f .Namespace ,
45
+ framework .HTTPBunService ,
46
+ 80 ,
47
+ annotations ))
44
48
45
49
f .WaitForNginxServer (host ,
46
50
func (server string ) bool {
@@ -51,23 +55,32 @@ var _ = framework.DescribeAnnotation("configuration-snippet", func() {
51
55
GET ("/" ).
52
56
WithHeader ("Host" , host ).
53
57
Expect ().
54
- Status (http .StatusOK ).Headers ().
58
+ Status (http .StatusOK ).
59
+ Headers ().
55
60
ValueEqual ("Foo1" , []string {"Bar1" })
56
61
})
57
62
58
- ginkgo .It (` drops snippet "more_set_headers "Foo1: Bar1";" in all locations if disabled by admin"` , func () {
63
+ ginkgo .It (" drops snippet more_set_header in all locations if disabled by admin" , func () {
59
64
host := "noconfigurationsnippet.foo.com"
60
65
annotations := map [string ]string {
61
- "nginx.ingress.kubernetes.io/configuration-snippet" : `
62
- more_set_headers "Foo1: Bar1";` ,
66
+ "nginx.ingress.kubernetes.io/configuration-snippet" : `more_set_headers "Foo1: Bar1";` ,
63
67
}
64
68
65
- ing := framework .NewSingleIngress (host , "/" , host , f .Namespace , framework .EchoService , 80 , annotations )
69
+ ing := framework .NewSingleIngress (
70
+ host ,
71
+ "/" ,
72
+ host ,
73
+ f .Namespace ,
74
+ framework .HTTPBunService ,
75
+ 80 ,
76
+ annotations )
77
+
66
78
f .UpdateNginxConfigMapData ("allow-snippet-annotations" , "false" )
67
79
defer func () {
68
80
// Return to the original value
69
81
f .UpdateNginxConfigMapData ("allow-snippet-annotations" , "true" )
70
82
}()
83
+
71
84
// Sleep a while just to guarantee that the configmap is applied
72
85
framework .Sleep ()
73
86
f .EnsureIngress (ing )
@@ -81,7 +94,8 @@ var _ = framework.DescribeAnnotation("configuration-snippet", func() {
81
94
GET ("/" ).
82
95
WithHeader ("Host" , host ).
83
96
Expect ().
84
- Status (http .StatusOK ).Headers ().
97
+ Status (http .StatusOK ).
98
+ Headers ().
85
99
NotContainsKey ("Foo1" )
86
100
})
87
101
})
0 commit comments