Skip to content

Commit

Permalink
wasm configuration based on extensions: envoygateway integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: Eguzki Astiz Lezaun <[email protected]>
  • Loading branch information
eguzki committed Sep 23, 2024
1 parent 2cd69fd commit 9547e83
Showing 1 changed file with 44 additions and 20 deletions.
64 changes: 44 additions & 20 deletions tests/envoygateway/wasm_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,17 @@ var _ = Describe("wasm controller", func() {
existingWASMConfig, err := wasm.ConfigFromJSON(ext.Spec.Wasm[0].Config)
Expect(err).ToNot(HaveOccurred())
Expect(existingWASMConfig).To(Equal(&wasm.Config{
FailureMode: wasm.FailureModeDeny,
RateLimitPolicies: []wasm.RateLimitPolicy{
Extensions: map[string]wasm.Extension{
wasm.RateLimitPolicyExtensionName: {
Endpoint: common.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
Type: wasm.RateLimitExtensionType,
},
},
Policies: []wasm.Policy{
{
Name: gwPolicyKey.String(),
Domain: wasm.LimitsNamespaceFromRLP(gwPolicy),
Name: gwPolicyKey.String(),
Hostnames: []string{gwHost},
Rules: []wasm.Rule{
{
Conditions: []wasm.Condition{
Expand All @@ -169,18 +175,24 @@ var _ = Describe("wasm controller", func() {
},
},
},
Data: []wasm.DataItem{
Actions: []wasm.Action{
{
Static: &wasm.StaticSpec{
Key: wasm.LimitNameToLimitadorIdentifier(gwPolicyKey, "l1"),
Value: "1",
Scope: wasm.LimitsNamespaceFromRLP(gwPolicy),
ExtensionName: wasm.RateLimitPolicyExtensionName,
Data: []wasm.DataType{
{
Value: &wasm.Static{
Static: wasm.StaticSpec{
Key: wasm.LimitNameToLimitadorIdentifier(gwPolicyKey, "l1"),
Value: "1",
},
},
},
},
},
},
},
},
Hostnames: []string{gwHost},
Service: common.KuadrantRateLimitClusterName,
},
},
}))
Expand Down Expand Up @@ -293,11 +305,17 @@ var _ = Describe("wasm controller", func() {
existingWASMConfig, err := wasm.ConfigFromJSON(ext.Spec.Wasm[0].Config)
Expect(err).ToNot(HaveOccurred())
Expect(existingWASMConfig).To(Equal(&wasm.Config{
FailureMode: wasm.FailureModeDeny,
RateLimitPolicies: []wasm.RateLimitPolicy{
Extensions: map[string]wasm.Extension{
wasm.RateLimitPolicyExtensionName: {
Endpoint: common.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
Type: wasm.RateLimitExtensionType,
},
},
Policies: []wasm.Policy{
{
Name: routePolicyKey.String(),
Domain: wasm.LimitsNamespaceFromRLP(routePolicy),
Name: routePolicyKey.String(),
Hostnames: []string{string(gwRoute.Spec.Hostnames[0])},
Rules: []wasm.Rule{
{
Conditions: []wasm.Condition{
Expand All @@ -316,18 +334,24 @@ var _ = Describe("wasm controller", func() {
},
},
},
Data: []wasm.DataItem{
Actions: []wasm.Action{
{
Static: &wasm.StaticSpec{
Key: wasm.LimitNameToLimitadorIdentifier(routePolicyKey, "l1"),
Value: "1",
Scope: wasm.LimitsNamespaceFromRLP(routePolicy),
ExtensionName: wasm.RateLimitPolicyExtensionName,
Data: []wasm.DataType{
{
Value: &wasm.Static{
Static: wasm.StaticSpec{
Key: wasm.LimitNameToLimitadorIdentifier(routePolicyKey, "l1"),
Value: "1",
},
},
},
},
},
},
},
},
Hostnames: []string{string(gwRoute.Spec.Hostnames[0])},
Service: common.KuadrantRateLimitClusterName,
},
},
}))
Expand Down

0 comments on commit 9547e83

Please sign in to comment.