From eb66d70f3600a16f6df47989bdaedc6c8373de60 Mon Sep 17 00:00:00 2001 From: dd di cesare Date: Mon, 18 Nov 2024 19:08:22 +0100 Subject: [PATCH] [refactor] Modifying tests in order to use the env getter fn Signed-off-by: dd di cesare --- pkg/wasm/utils.go | 4 +- .../envoygateway/extension_reconciler_test.go | 8 +-- tests/istio/extension_reconciler_test.go | 54 +++++++++---------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/pkg/wasm/utils.go b/pkg/wasm/utils.go index f4625387b..976fc1037 100644 --- a/pkg/wasm/utils.go +++ b/pkg/wasm/utils.go @@ -32,7 +32,7 @@ func AuthServiceTimeout() string { } func AuthServiceFailureMode() FailureModeType { - return parseFailureModeValue("AUTH_SERVICE_FAILURE_MODE", FailureModeAllow) + return parseFailureModeValue("AUTH_SERVICE_FAILURE_MODE", FailureModeDeny) } func RatelimitServiceTimeout() string { @@ -40,7 +40,7 @@ func RatelimitServiceTimeout() string { } func RatelimitServiceFailureMode() FailureModeType { - return parseFailureModeValue("RATELIMIT_SERVICE_FAILURE_MODE", FailureModeDeny) + return parseFailureModeValue("RATELIMIT_SERVICE_FAILURE_MODE", FailureModeAllow) } func parseFailureModeValue(envVarName string, defaultValue FailureModeType) FailureModeType { diff --git a/tests/envoygateway/extension_reconciler_test.go b/tests/envoygateway/extension_reconciler_test.go index 984791af3..020cbd4a1 100644 --- a/tests/envoygateway/extension_reconciler_test.go +++ b/tests/envoygateway/extension_reconciler_test.go @@ -171,13 +171,13 @@ var _ = Describe("wasm controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -337,13 +337,13 @@ var _ = Describe("wasm controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, diff --git a/tests/istio/extension_reconciler_test.go b/tests/istio/extension_reconciler_test.go index 39b235a0e..9d411172c 100644 --- a/tests/istio/extension_reconciler_test.go +++ b/tests/istio/extension_reconciler_test.go @@ -148,13 +148,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -287,7 +287,7 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Expect(err).ToNot(HaveOccurred()) Expect(existingWASMConfig.Services).To(HaveKeyWithValue(wasm.RateLimitServiceName, wasm.Service{ Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Type: wasm.RateLimitServiceType, Timeout: ptr.To(wasm.RatelimitServiceTimeout()), })) @@ -716,13 +716,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -939,13 +939,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -1151,13 +1151,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -1281,13 +1281,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -1483,13 +1483,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -1576,13 +1576,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -1753,13 +1753,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -1864,13 +1864,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -2077,13 +2077,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -2185,13 +2185,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -2352,13 +2352,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, }, @@ -2430,13 +2430,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { wasm.AuthServiceName: { Type: wasm.AuthServiceType, Endpoint: kuadrant.KuadrantAuthClusterName, - FailureMode: wasm.FailureModeDeny, + FailureMode: wasm.AuthServiceFailureMode(), Timeout: ptr.To(wasm.AuthServiceTimeout()), }, wasm.RateLimitServiceName: { Type: wasm.RateLimitServiceType, Endpoint: kuadrant.KuadrantRateLimitClusterName, - FailureMode: wasm.FailureModeAllow, + FailureMode: wasm.RatelimitServiceFailureMode(), Timeout: ptr.To(wasm.RatelimitServiceTimeout()), }, },