Skip to content

Commit

Permalink
e2e: missing cluster: test second action
Browse files Browse the repository at this point in the history
Signed-off-by: Eguzki Astiz Lezaun <eastizle@redhat.com>
  • Loading branch information
eguzki committed Oct 31, 2024
1 parent 59f308a commit 95c002d
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 7 deletions.
8 changes: 7 additions & 1 deletion e2e/missing-cluster/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;\
}
Expand Down
52 changes: 48 additions & 4 deletions e2e/missing-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
38 changes: 36 additions & 2 deletions e2e/missing-cluster/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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"
}
}
]
}
]
}
]
}
Expand Down

0 comments on commit 95c002d

Please sign in to comment.