diff --git a/tests/framework/crossplane.go b/tests/framework/crossplane.go index ea2f5bc83..81f47e356 100644 --- a/tests/framework/crossplane.go +++ b/tests/framework/crossplane.go @@ -52,18 +52,18 @@ func ValidateNginxFieldExists(conf *Payload, expFieldCfg ExpectedNginxField) err } for _, directive := range config.Parsed { - if len(expFieldCfg.Server) == 0 && len(expFieldCfg.Upstream) == 0 { + if expFieldCfg.Server == "" && expFieldCfg.Upstream == "" { if expFieldCfg.fieldFound(directive) { return nil } continue } - if len(expFieldCfg.Server) > 0 && fieldExistsInServer(expFieldCfg, *directive) { + if expFieldCfg.Server != "" && fieldExistsInServer(expFieldCfg, *directive) { return nil } - if len(expFieldCfg.Upstream) > 0 && fieldExistsInUpstream(expFieldCfg, *directive) { + if expFieldCfg.Upstream != "" && fieldExistsInUpstream(expFieldCfg, *directive) { return nil } } diff --git a/tests/suite/upstream_settings_test.go b/tests/suite/upstream_settings_test.go index 4d92797e4..8bd9638af 100644 --- a/tests/suite/upstream_settings_test.go +++ b/tests/suite/upstream_settings_test.go @@ -64,7 +64,7 @@ var _ = Describe("UpstreamSettingsPolicy", Ordered, Label("functional", "uspolic Specify("they are accepted", func() { usPolicies := []string{ - // "multiple-http-svc-usp", + "multiple-http-svc-usp", "grpc-svc-usp", } @@ -81,32 +81,32 @@ var _ = Describe("UpstreamSettingsPolicy", Ordered, Label("functional", "uspolic } }) - // Context("verify working traffic", func() { - // It("should return a 200 response for HTTPRoutes", func() { - // port := 80 - // if portFwdPort != 0 { - // port = portFwdPort - // } - // baseCoffeeURL := fmt.Sprintf("http://cafe.example.com:%d%s", port, "/coffee") - // baseTeaURL := fmt.Sprintf("http://cafe.example.com:%d%s", port, "/tea") - - // Eventually( - // func() error { - // return expectRequestToSucceed(baseCoffeeURL, address, "URI: /coffee") - // }). - // WithTimeout(timeoutConfig.RequestTimeout). - // WithPolling(500 * time.Millisecond). - // Should(Succeed()) - - // Eventually( - // func() error { - // return expectRequestToSucceed(baseTeaURL, address, "URI: /tea") - // }). - // WithTimeout(timeoutConfig.RequestTimeout). - // WithPolling(500 * time.Millisecond). - // Should(Succeed()) - // }) - // }) + Context("verify working traffic", func() { + It("should return a 200 response for HTTPRoutes", func() { + port := 80 + if portFwdPort != 0 { + port = portFwdPort + } + baseCoffeeURL := fmt.Sprintf("http://cafe.example.com:%d%s", port, "/coffee") + baseTeaURL := fmt.Sprintf("http://cafe.example.com:%d%s", port, "/tea") + + Eventually( + func() error { + return expectRequestToSucceed(baseCoffeeURL, address, "URI: /coffee") + }). + WithTimeout(timeoutConfig.RequestTimeout). + WithPolling(500 * time.Millisecond). + Should(Succeed()) + + Eventually( + func() error { + return expectRequestToSucceed(baseTeaURL, address, "URI: /tea") + }). + WithTimeout(timeoutConfig.RequestTimeout). + WithPolling(500 * time.Millisecond). + Should(Succeed()) + }) + }) Context("nginx directives", func() { var conf *framework.Payload @@ -128,78 +128,78 @@ var _ = Describe("UpstreamSettingsPolicy", Ordered, Label("functional", "uspolic Expect(framework.ValidateNginxFieldExists(conf, expCfg)).To(Succeed()) } }, - // Entry("HTTP upstreams", []framework.ExpectedNginxField{ - // { - // Directive: "upstream", - // Value: "uspolicy_coffee_80", - // File: "http.conf", - // }, - // { - // Directive: "upstream", - // Value: "uspolicy_tea_80", - // File: "http.conf", - // }, - // { - // Directive: "zone", - // Value: "uspolicy_coffee_80 512k", - // Upstream: "uspolicy_coffee_80", - // File: "http.conf", - // }, - // { - // Directive: "zone", - // Value: "uspolicy_tea_80 512k", - // Upstream: "uspolicy_tea_80", - // File: "http.conf", - // }, - // { - // Directive: "keepalive", - // Value: "10", - // Upstream: "uspolicy_coffee_80", - // File: "http.conf", - // }, - // { - // Directive: "keepalive", - // Value: "10", - // Upstream: "uspolicy_tea_80", - // File: "http.conf", - // }, - // { - // Directive: "keepalive_requests", - // Value: "3", - // Upstream: "uspolicy_coffee_80", - // File: "http.conf", - // }, - // { - // Directive: "keepalive_requests", - // Value: "3", - // Upstream: "uspolicy_tea_80", - // File: "http.conf", - // }, - // { - // Directive: "keepalive_time", - // Value: "10s", - // Upstream: "uspolicy_coffee_80", - // File: "http.conf", - // }, - // { - // Directive: "keepalive_time", - // Value: "10s", - // Upstream: "uspolicy_tea_80", - // File: "http.conf", - // }, - // { - // Directive: "keepalive_timeout", - // Value: "50s", - // Upstream: "uspolicy_coffee_80", - // File: "http.conf", - // }, - // { - // Directive: "keepalive_timeout", - // Value: "50s", - // Upstream: "uspolicy_tea_80", - // File: "http.conf", - // }, - // }), + Entry("HTTP upstreams", []framework.ExpectedNginxField{ + { + Directive: "upstream", + Value: "uspolicy_coffee_80", + File: "http.conf", + }, + { + Directive: "upstream", + Value: "uspolicy_tea_80", + File: "http.conf", + }, + { + Directive: "zone", + Value: "uspolicy_coffee_80 512k", + Upstream: "uspolicy_coffee_80", + File: "http.conf", + }, + { + Directive: "zone", + Value: "uspolicy_tea_80 512k", + Upstream: "uspolicy_tea_80", + File: "http.conf", + }, + { + Directive: "keepalive", + Value: "10", + Upstream: "uspolicy_coffee_80", + File: "http.conf", + }, + { + Directive: "keepalive", + Value: "10", + Upstream: "uspolicy_tea_80", + File: "http.conf", + }, + { + Directive: "keepalive_requests", + Value: "3", + Upstream: "uspolicy_coffee_80", + File: "http.conf", + }, + { + Directive: "keepalive_requests", + Value: "3", + Upstream: "uspolicy_tea_80", + File: "http.conf", + }, + { + Directive: "keepalive_time", + Value: "10s", + Upstream: "uspolicy_coffee_80", + File: "http.conf", + }, + { + Directive: "keepalive_time", + Value: "10s", + Upstream: "uspolicy_tea_80", + File: "http.conf", + }, + { + Directive: "keepalive_timeout", + Value: "50s", + Upstream: "uspolicy_coffee_80", + File: "http.conf", + }, + { + Directive: "keepalive_timeout", + Value: "50s", + Upstream: "uspolicy_tea_80", + File: "http.conf", + }, + }), Entry("GRPC upstreams", []framework.ExpectedNginxField{ { Directive: "zone",