From 95c002d1fa86e76a43a4733d1698fa9881066dfd Mon Sep 17 00:00:00 2001 From: Eguzki Astiz Lezaun Date: Thu, 31 Oct 2024 09:28:29 +0100 Subject: [PATCH] e2e: missing cluster: test second action Signed-off-by: Eguzki Astiz Lezaun --- e2e/missing-cluster/Makefile | 8 +++++- e2e/missing-cluster/README.md | 52 +++++++++++++++++++++++++++++++--- e2e/missing-cluster/envoy.yaml | 38 +++++++++++++++++++++++-- 3 files changed, 91 insertions(+), 7 deletions(-) diff --git a/e2e/missing-cluster/Makefile b/e2e/missing-cluster/Makefile index 2879e06..8f8c354 100644 --- a/e2e/missing-cluster/Makefile +++ b/e2e/missing-cluster/Makefile @@ -11,7 +11,13 @@ run: test: @{ \ set -e ;\ - STATUSCODE=$(shell curl --silent --output /dev/null --write-out "%{http_code}" --max-time 5 --resolve test.example.com:18000:127.0.0.1 http://test.example.com:18000) && \ + STATUSCODE=$(shell curl --silent --output /dev/null --write-out "%{http_code}" --max-time 5 --resolve fail-on-first-action.example.com:18000:127.0.0.1 http://fail-on-first-action.example.com:18000) && \ + echo "received status code $${STATUSCODE}" && \ + test $${STATUSCODE} -ne 200 ;\ + } + @{ \ + set -e ;\ + STATUSCODE=$(shell curl --silent --output /dev/null --write-out "%{http_code}" --max-time 5 --resolve fail-on-second-action.example.com:18000:127.0.0.1 http://fail-on-second-action.example.com:18000) && \ echo "received status code $${STATUSCODE}" && \ test $${STATUSCODE} -ne 200 ;\ } diff --git a/e2e/missing-cluster/README.md b/e2e/missing-cluster/README.md index 14139c6..0555ba8 100644 --- a/e2e/missing-cluster/README.md +++ b/e2e/missing-cluster/README.md @@ -2,17 +2,21 @@ This is a integration test to validate when envoy cluster does not exist. -Specifically, when happens on the second action. +The test configures not existing envoy cluster on the fist action `fail-on-first-action.example.com`, +as well as on the second action `fail-on-second-action.example.com`. Reason being to validate +error handling on the `on_grpc_call_response` event. This test is being added to the CI test suite ### Description -The Wasm configuration defines a set of rules for `*.example.com` and the rate limiting endpoint does -not exist from the defined set of envoy clusters. - ```json "services": { + "existing-service": { + "type": "ratelimit", + "endpoint": "existing-cluster", + "failureMode": "deny" + } "mistyped-service": { "type": "ratelimit", "endpoint": "does-not-exist", @@ -21,7 +25,47 @@ not exist from the defined set of envoy clusters. }, "actionSets": [ { + "name": "envoy-cluster-not-found-on-first-action", + "routeRuleConditions": { + "hostnames": [ + "fail-on-first-action.example.com" + ] + }, + "actions": [ + { + "service": "mistyped-service", + "scope": "b", + "data": [ + { + "expression": { + "key": "limit_to_be_activated", + "value": "1" + } + } + ] + } + ] +}, +{ + "name": "envoy-cluster-not-found-on-second-action", + "routeRuleConditions": { + "hostnames": [ + "fail-on-second-action.example.com" + ] + }, "actions": [ + { + "service": "existing-service", + "scope": "b", + "data": [ + { + "expression": { + "key": "limit_to_be_activated", + "value": "1" + } + } + ] + }, { "service": "mistyped-service", "scope": "b", diff --git a/e2e/missing-cluster/envoy.yaml b/e2e/missing-cluster/envoy.yaml index 78a92dc..1692977 100644 --- a/e2e/missing-cluster/envoy.yaml +++ b/e2e/missing-cluster/envoy.yaml @@ -57,10 +57,10 @@ static_resources: }, "actionSets": [ { - "name": "envoy-cluster-not-found-actionset", + "name": "envoy-cluster-not-found-on-first-action", "routeRuleConditions": { "hostnames": [ - "*.example.com" + "fail-on-first-action.example.com" ] }, "actions": [ @@ -77,6 +77,40 @@ static_resources: ] } ] + }, + { + "name": "envoy-cluster-not-found-on-second-action", + "routeRuleConditions": { + "hostnames": [ + "fail-on-second-action.example.com" + ] + }, + "actions": [ + { + "service": "limitador", + "scope": "a", + "data": [ + { + "expression": { + "key": "limit_to_be_activated", + "value": "1" + } + } + ] + }, + { + "service": "mistyped-service", + "scope": "a", + "data": [ + { + "expression": { + "key": "limit_to_be_activated", + "value": "1" + } + } + ] + } + ] } ] }