From 46400a033f9cdf1088d103d78a0bbf64aed9de3f Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Wed, 25 Aug 2021 16:53:21 +0100 Subject: [PATCH] Add Envoy integration test to show Header manip can interpolate Envoy variables --- .../connect/envoy/case-ingress-gateway-http/config_entries.hcl | 1 + .../connect/envoy/case-ingress-gateway-http/verify.bats | 3 +++ 2 files changed, 4 insertions(+) diff --git a/test/integration/connect/envoy/case-ingress-gateway-http/config_entries.hcl b/test/integration/connect/envoy/case-ingress-gateway-http/config_entries.hcl index e4128ed63..10c939510 100644 --- a/test/integration/connect/envoy/case-ingress-gateway-http/config_entries.hcl +++ b/test/integration/connect/envoy/case-ingress-gateway-http/config_entries.hcl @@ -25,6 +25,7 @@ config_entries { } set { x-existing-2 = "replaced-req" + x-client-ip = "%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%" } remove = ["x-bad-req"] } diff --git a/test/integration/connect/envoy/case-ingress-gateway-http/verify.bats b/test/integration/connect/envoy/case-ingress-gateway-http/verify.bats index fef09b444..8640d1901 100644 --- a/test/integration/connect/envoy/case-ingress-gateway-http/verify.bats +++ b/test/integration/connect/envoy/case-ingress-gateway-http/verify.bats @@ -63,6 +63,9 @@ load helpers # Ingress should have replaced the second existing header echo "$output" | grep -E "^X-Existing-2: replaced-req" + # Ingress should have set the client ip from dynamic Envoy variable + echo "$output" | grep -E "^X-Client-Ip: 127.0.0.1" + # Ingress should have removed the bad request header if echo "$output" | grep -E "^X-Bad-Req: true"; then echo "X-Bad-Req request header should have been stripped but was still present"