Skip to content

Commit

Permalink
enable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
salonichf5 committed Dec 20, 2024
1 parent 6666868 commit 6e267ea
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 102 deletions.
6 changes: 3 additions & 3 deletions tests/framework/crossplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
198 changes: 99 additions & 99 deletions tests/suite/upstream_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}

Expand All @@ -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
Expand All @@ -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",
Expand Down

0 comments on commit 6e267ea

Please sign in to comment.