Skip to content

Commit

Permalink
[refactor] Modifying tests in order to use the env getter fn
Browse files Browse the repository at this point in the history
Signed-off-by: dd di cesare <didi@posteo.net>
  • Loading branch information
didierofrivia committed Nov 18, 2024
1 parent fa423a8 commit b59b48e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions pkg/wasm/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ func AuthServiceTimeout() string {
}

func AuthServiceFailureMode() FailureModeType {
return parseFailureModeValue("AUTH_SERVICE_FAILURE_MODE", FailureModeAllow)
return parseFailureModeValue("AUTH_SERVICE_FAILURE_MODE", FailureModeDeny)
}

func RatelimitServiceTimeout() string {
return env.GetString("RATELIMIT_SERVICE_TIMEOUT", "100ms")
}

func RatelimitServiceFailureMode() FailureModeType {
return parseFailureModeValue("RATELIMIT_SERVICE_FAILURE_MODE", FailureModeDeny)
return parseFailureModeValue("RATELIMIT_SERVICE_FAILURE_MODE", FailureModeAllow)
}

func parseFailureModeValue(envVarName string, defaultValue FailureModeType) FailureModeType {
Expand Down
8 changes: 4 additions & 4 deletions tests/envoygateway/extension_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ var _ = Describe("wasm controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -337,13 +337,13 @@ var _ = Describe("wasm controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down
54 changes: 27 additions & 27 deletions tests/istio/extension_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -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: ptr.To(wasm.RatelimitServiceFailureMode()),
Type: wasm.RateLimitServiceType,
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
}))
Expand Down Expand Up @@ -716,13 +716,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -939,13 +939,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -1151,13 +1151,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -1281,13 +1281,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -1483,13 +1483,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -1576,13 +1576,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -1753,13 +1753,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -1864,13 +1864,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -2077,13 +2077,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -2185,13 +2185,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -2352,13 +2352,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down Expand Up @@ -2430,13 +2430,13 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
wasm.AuthServiceName: {
Type: wasm.AuthServiceType,
Endpoint: kuadrant.KuadrantAuthClusterName,
FailureMode: wasm.FailureModeDeny,
FailureMode: ptr.To(wasm.AuthServiceFailureMode()),
Timeout: ptr.To(wasm.AuthServiceTimeout()),
},
wasm.RateLimitServiceName: {
Type: wasm.RateLimitServiceType,
Endpoint: kuadrant.KuadrantRateLimitClusterName,
FailureMode: wasm.FailureModeAllow,
FailureMode: ptr.To(wasm.RatelimitServiceFailureMode()),
Timeout: ptr.To(wasm.RatelimitServiceTimeout()),
},
},
Expand Down

0 comments on commit b59b48e

Please sign in to comment.