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() {
|
||||
f := framework.NewDefaultFramework("configurationsnippet")
|
||||
f := framework.NewDefaultFramework(
|
||||
"configurationsnippet",
|
||||
framework.WithHTTPBunEnabled(),
|
||||
)
|
||||
|
||||
ginkgo.BeforeEach(func() {
|
||||
f.NewEchoDeployment()
|
||||
})
|
||||
|
||||
ginkgo.It(`set snippet "more_set_headers "Foo1: Bar1";" in all locations"`, func() {
|
||||
ginkgo.It("set snippet more_set_headers in all locations", func() {
|
||||
host := "configurationsnippet.foo.com"
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/configuration-snippet": `
|
||||
more_set_headers "Foo1: Bar1";`,
|
||||
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Foo1: Bar1";`,
|
||||
}
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
|
||||
f.EnsureIngress(ing)
|
||||
f.EnsureIngress(framework.NewSingleIngress(
|
||||
host,
|
||||
"/",
|
||||
host,
|
||||
f.Namespace,
|
||||
framework.HTTPBunService,
|
||||
80,
|
||||
annotations))
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
|
@ -51,23 +55,32 @@ var _ = framework.DescribeAnnotation("configuration-snippet", func() {
|
|||
GET("/").
|
||||
WithHeader("Host", host).
|
||||
Expect().
|
||||
Status(http.StatusOK).Headers().
|
||||
Status(http.StatusOK).
|
||||
Headers().
|
||||
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"
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/configuration-snippet": `
|
||||
more_set_headers "Foo1: Bar1";`,
|
||||
"nginx.ingress.kubernetes.io/configuration-snippet": `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")
|
||||
defer func() {
|
||||
// Return to the original value
|
||||
f.UpdateNginxConfigMapData("allow-snippet-annotations", "true")
|
||||
}()
|
||||
|
||||
// Sleep a while just to guarantee that the configmap is applied
|
||||
framework.Sleep()
|
||||
f.EnsureIngress(ing)
|
||||
|
@ -81,7 +94,8 @@ var _ = framework.DescribeAnnotation("configuration-snippet", func() {
|
|||
GET("/").
|
||||
WithHeader("Host", host).
|
||||
Expect().
|
||||
Status(http.StatusOK).Headers().
|
||||
Status(http.StatusOK).
|
||||
Headers().
|
||||
NotContainsKey("Foo1")
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue