Skip to content

Commit

Permalink
tests: fix integration tests - order of wasm action sets (again!)
Browse files Browse the repository at this point in the history
Signed-off-by: Guilherme Cassolato <[email protected]>
  • Loading branch information
guicassolato committed Oct 17, 2024
1 parent 3040027 commit 0b76b6c
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tests/istio/extension_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
},
ActionSets: []wasm.ActionSet{
{
Name: wasm.ActionSetNameForPath(pathID, 1, "*.example.com"),
Name: wasm.ActionSetNameForPath(pathID, 0, "*.example.com"),
RouteRuleConditions: wasm.RouteRuleConditions{
Hostnames: []string{"*.example.com"},
Matches: []wasm.Predicate{
Expand Down Expand Up @@ -306,11 +306,11 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
httpRouteRuleToys := &machinery.HTTPRouteRule{HTTPRoute: mHTTPRoute, HTTPRouteRule: &httpRoute.Spec.Rules[0], Name: "rule-1"}
httpRouteRuleAssets := &machinery.HTTPRouteRule{HTTPRoute: mHTTPRoute, HTTPRouteRule: &httpRoute.Spec.Rules[1], Name: "rule-2"}

// api.toystore.io/assets*
// *.toystore.acme.com/assets*
actionSet := existingWASMConfig.ActionSets[0]
pathID := kuadrantv1.PathID(append(basePath, httpRouteRuleAssets))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 0, "api.toystore.io")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"api.toystore.io"}))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 0, "*.toystore.acme.com")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"*.toystore.acme.com"}))
Expect(actionSet.RouteRuleConditions.Matches).To(ContainElements(
wasm.Predicate{
Selector: "request.url_path",
Expand Down Expand Up @@ -364,11 +364,11 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
},
))

// GET api.toystore.io/toys*
// GET *.toystore.acme.com/toys*
actionSet = existingWASMConfig.ActionSets[1]
pathID = kuadrantv1.PathID(append(basePath, httpRouteRuleToys))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 0, "api.toystore.io")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"api.toystore.io"}))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 0, "*.toystore.acme.com")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"*.toystore.acme.com"}))
Expect(actionSet.RouteRuleConditions.Matches).To(ContainElements(
wasm.Predicate{
Selector: "request.method",
Expand Down Expand Up @@ -427,11 +427,11 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
},
))

// POST api.toystore.io/toys*
// POST *.toystore.acme.com/toys*
actionSet = existingWASMConfig.ActionSets[2]
pathID = kuadrantv1.PathID(append(basePath, httpRouteRuleToys))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 1, "api.toystore.io")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"api.toystore.io"}))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 1, "*.toystore.acme.com")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"*.toystore.acme.com"}))
Expect(actionSet.RouteRuleConditions.Matches).To(ContainElements(
wasm.Predicate{
Selector: "request.method",
Expand Down Expand Up @@ -490,11 +490,11 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
},
))

// *.toystore.acme.com/assets*
// api.toystore.io/assets*
actionSet = existingWASMConfig.ActionSets[3]
pathID = kuadrantv1.PathID(append(basePath, httpRouteRuleAssets))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 0, "*.toystore.acme.com")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"*.toystore.acme.com"}))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 0, "api.toystore.io")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"api.toystore.io"}))
Expect(actionSet.RouteRuleConditions.Matches).To(ContainElements(
wasm.Predicate{
Selector: "request.url_path",
Expand Down Expand Up @@ -548,11 +548,11 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
},
))

// GET *.toystore.acme.com/toys*
// GET api.toystore.io/toys*
actionSet = existingWASMConfig.ActionSets[4]
pathID = kuadrantv1.PathID(append(basePath, httpRouteRuleToys))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 0, "*.toystore.acme.com")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"*.toystore.acme.com"}))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 0, "api.toystore.io")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"api.toystore.io"}))
Expect(actionSet.RouteRuleConditions.Matches).To(ContainElements(
wasm.Predicate{
Selector: "request.method",
Expand Down Expand Up @@ -611,11 +611,11 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
},
))

// POST *.toystore.acme.com/toys*
// POST api.toystore.io/toys*
actionSet = existingWASMConfig.ActionSets[5]
pathID = kuadrantv1.PathID(append(basePath, httpRouteRuleToys))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 1, "*.toystore.acme.com")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"*.toystore.acme.com"}))
Expect(actionSet.Name).To(Equal(wasm.ActionSetNameForPath(pathID, 1, "api.toystore.io")))
Expect(actionSet.RouteRuleConditions.Hostnames).To(Equal([]string{"api.toystore.io"}))
Expect(actionSet.RouteRuleConditions.Matches).To(ContainElements(
wasm.Predicate{
Selector: "request.method",
Expand Down

0 comments on commit 0b76b6c

Please sign in to comment.