chore: remove echo from snippet tests (#10110)
Signed-off-by: Spazzy <brendankamp757@gmail.com>
This commit is contained in:
parent
08158df8c0
commit
f8bf5a3086
1 changed files with 30 additions and 16 deletions
|
@ -26,21 +26,25 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = framework.DescribeAnnotation("configuration-snippet", func() {
|
var _ = framework.DescribeAnnotation("configuration-snippet", func() {
|
||||||
f := framework.NewDefaultFramework("configurationsnippet")
|
f := framework.NewDefaultFramework(
|
||||||
|
"configurationsnippet",
|
||||||
|
framework.WithHTTPBunEnabled(),
|
||||||
|
)
|
||||||
|
|
||||||
ginkgo.BeforeEach(func() {
|
ginkgo.It("set snippet more_set_headers in all locations", func() {
|
||||||
f.NewEchoDeployment()
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.It(`set snippet "more_set_headers "Foo1: Bar1";" in all locations"`, func() {
|
|
||||||
host := "configurationsnippet.foo.com"
|
host := "configurationsnippet.foo.com"
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/configuration-snippet": `
|
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Foo1: Bar1";`,
|
||||||
more_set_headers "Foo1: Bar1";`,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
|
f.EnsureIngress(framework.NewSingleIngress(
|
||||||
f.EnsureIngress(ing)
|
host,
|
||||||
|
"/",
|
||||||
|
host,
|
||||||
|
f.Namespace,
|
||||||
|
framework.HTTPBunService,
|
||||||
|
80,
|
||||||
|
annotations))
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
|
@ -51,23 +55,32 @@ var _ = framework.DescribeAnnotation("configuration-snippet", func() {
|
||||||
GET("/").
|
GET("/").
|
||||||
WithHeader("Host", host).
|
WithHeader("Host", host).
|
||||||
Expect().
|
Expect().
|
||||||
Status(http.StatusOK).Headers().
|
Status(http.StatusOK).
|
||||||
|
Headers().
|
||||||
ValueEqual("Foo1", []string{"Bar1"})
|
ValueEqual("Foo1", []string{"Bar1"})
|
||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It(`drops snippet "more_set_headers "Foo1: Bar1";" in all locations if disabled by admin"`, func() {
|
ginkgo.It("drops snippet more_set_header in all locations if disabled by admin", func() {
|
||||||
host := "noconfigurationsnippet.foo.com"
|
host := "noconfigurationsnippet.foo.com"
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/configuration-snippet": `
|
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Foo1: Bar1";`,
|
||||||
more_set_headers "Foo1: Bar1";`,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
|
ing := framework.NewSingleIngress(
|
||||||
|
host,
|
||||||
|
"/",
|
||||||
|
host,
|
||||||
|
f.Namespace,
|
||||||
|
framework.HTTPBunService,
|
||||||
|
80,
|
||||||
|
annotations)
|
||||||
|
|
||||||
f.UpdateNginxConfigMapData("allow-snippet-annotations", "false")
|
f.UpdateNginxConfigMapData("allow-snippet-annotations", "false")
|
||||||
defer func() {
|
defer func() {
|
||||||
// Return to the original value
|
// Return to the original value
|
||||||
f.UpdateNginxConfigMapData("allow-snippet-annotations", "true")
|
f.UpdateNginxConfigMapData("allow-snippet-annotations", "true")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Sleep a while just to guarantee that the configmap is applied
|
// Sleep a while just to guarantee that the configmap is applied
|
||||||
framework.Sleep()
|
framework.Sleep()
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
@ -81,7 +94,8 @@ var _ = framework.DescribeAnnotation("configuration-snippet", func() {
|
||||||
GET("/").
|
GET("/").
|
||||||
WithHeader("Host", host).
|
WithHeader("Host", host).
|
||||||
Expect().
|
Expect().
|
||||||
Status(http.StatusOK).Headers().
|
Status(http.StatusOK).
|
||||||
|
Headers().
|
||||||
NotContainsKey("Foo1")
|
NotContainsKey("Foo1")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue