From 8eac53ca30178adbcac8c8098788cd1e00dbf0c2 Mon Sep 17 00:00:00 2001 From: Ricardo Katz Date: Wed, 13 Nov 2024 06:39:58 -0700 Subject: [PATCH] Fix test assertion --- test/e2e/lua/dynamic_configuration.go | 3 ++- test/e2e/metrics/metrics.go | 3 ++- test/e2e/settings/badannotationvalues.go | 12 ++++++++---- test/e2e/settings/limit_rate.go | 3 ++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/test/e2e/lua/dynamic_configuration.go b/test/e2e/lua/dynamic_configuration.go index 8f1deaeb12..a63a7a37d9 100644 --- a/test/e2e/lua/dynamic_configuration.go +++ b/test/e2e/lua/dynamic_configuration.go @@ -212,7 +212,8 @@ func createIngress(f *framework.Framework, host, deploymentName string) { f.WaitForNginxServer(host, func(server string) bool { - return strings.Contains(server, fmt.Sprintf("server_name %s;", host)) && + return (strings.Contains(server, fmt.Sprintf("server_name %s;", host)) || + strings.Contains(server, fmt.Sprintf("server_name %s ;", host))) && strings.Contains(server, "proxy_pass http://upstream_balancer;") }) } diff --git a/test/e2e/metrics/metrics.go b/test/e2e/metrics/metrics.go index 3cdb88057e..2100eefd2a 100644 --- a/test/e2e/metrics/metrics.go +++ b/test/e2e/metrics/metrics.go @@ -43,7 +43,8 @@ var _ = framework.IngressNginxDescribe("[metrics] exported prometheus metrics", f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, nil)) f.WaitForNginxServer(host, func(server string) bool { - return strings.Contains(server, fmt.Sprintf("server_name %s;", host)) && + return (strings.Contains(server, fmt.Sprintf("server_name %s;", host)) || + strings.Contains(server, fmt.Sprintf("server_name %s ;", host))) && strings.Contains(server, "proxy_pass http://upstream_balancer;") }) }) diff --git a/test/e2e/settings/badannotationvalues.go b/test/e2e/settings/badannotationvalues.go index bee12e66a2..4459a8da8b 100644 --- a/test/e2e/settings/badannotationvalues.go +++ b/test/e2e/settings/badannotationvalues.go @@ -50,7 +50,8 @@ var _ = framework.DescribeAnnotation("Bad annotation values", func() { f.WaitForNginxServer(host, func(server string) bool { - return !strings.Contains(server, fmt.Sprintf("server_name %s;", host)) + return !strings.Contains(server, fmt.Sprintf("server_name %s;", host)) && + !strings.Contains(server, fmt.Sprintf("server_name %s ;", host)) }) f.WaitForNginxServer(host, @@ -87,7 +88,8 @@ var _ = framework.DescribeAnnotation("Bad annotation values", func() { f.WaitForNginxServer(host, func(server string) bool { - return !strings.Contains(server, fmt.Sprintf("server_name %s;", host)) + return !strings.Contains(server, fmt.Sprintf("server_name %s;", host)) && + !strings.Contains(server, fmt.Sprintf("server_name %s ;", host)) }) f.WaitForNginxServer(host, @@ -123,7 +125,8 @@ var _ = framework.DescribeAnnotation("Bad annotation values", func() { f.WaitForNginxServer(hostValid, func(server string) bool { - return strings.Contains(server, fmt.Sprintf("server_name %s;", hostValid)) + return strings.Contains(server, fmt.Sprintf("server_name %s;", hostValid)) || + strings.Contains(server, fmt.Sprintf("server_name %s ;", hostValid)) }) f.WaitForNginxServer(hostValid, @@ -156,7 +159,8 @@ var _ = framework.DescribeAnnotation("Bad annotation values", func() { f.WaitForNginxServer(host, func(server string) bool { - return !strings.Contains(server, fmt.Sprintf("server_name %s;", host)) + return !strings.Contains(server, fmt.Sprintf("server_name %s;", host)) && + !strings.Contains(server, fmt.Sprintf("server_name %s ;", host)) }) f.WaitForNginxServer(host, diff --git a/test/e2e/settings/limit_rate.go b/test/e2e/settings/limit_rate.go index 16ce982778..41c54da852 100644 --- a/test/e2e/settings/limit_rate.go +++ b/test/e2e/settings/limit_rate.go @@ -41,7 +41,8 @@ var _ = framework.DescribeSetting("Configmap - limit-rate", func() { f.EnsureIngress(ing) f.WaitForNginxServer(host, func(server string) bool { - return strings.Contains(server, fmt.Sprintf("server_name %s;", host)) + return strings.Contains(server, fmt.Sprintf("server_name %s;", host)) || + strings.Contains(server, fmt.Sprintf("server_name %s ;", host)) }) wlKey := "limit-rate"