mirror of https://github.com/status-im/consul.git
integ test: reduce flakiness due to compound output from retry (#15233)
* integ test: avoid flakiness due to compound output from retry * changelog
This commit is contained in:
parent
bd1019fadb
commit
94d232ab1e
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note: improvement
|
||||||
|
integ test: fix flakiness due to test condition from retry app endoint
|
||||||
|
```
|
|
@ -33,13 +33,13 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2" {
|
@test "s1 upstream should be able to connect to s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 proxy should have been configured with one rbac listener filter at L4" {
|
@test "s1 proxy should have been configured with one rbac listener filter at L4" {
|
||||||
LISTEN_FILTERS=$(get_envoy_listener_filters localhost:19000)
|
LISTEN_FILTERS=$(get_envoy_listener_filters localhost:19000)
|
||||||
PUB=$(echo "$LISTEN_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ' )
|
PUB=$(echo "$LISTEN_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ')
|
||||||
UPS=$(echo "$LISTEN_FILTERS" | grep -E "^(default\/default\/)?s2:" | cut -f 2 -d ' ' )
|
UPS=$(echo "$LISTEN_FILTERS" | grep -E "^(default\/default\/)?s2:" | cut -f 2 -d ' ')
|
||||||
|
|
||||||
echo "LISTEN_FILTERS = $LISTEN_FILTERS"
|
echo "LISTEN_FILTERS = $LISTEN_FILTERS"
|
||||||
echo "PUB = $PUB"
|
echo "PUB = $PUB"
|
||||||
|
|
|
@ -29,7 +29,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
||||||
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 proxy should be exposing metrics to prometheus from central config" {
|
@test "s1 proxy should be exposing metrics to prometheus from central config" {
|
||||||
|
|
|
@ -49,11 +49,10 @@ load helpers
|
||||||
assert_upstream_has_endpoints_in_status 127.0.0.1:19000 failover-target~s2.default.primary-to-alpha.external HEALTHY 1
|
assert_upstream_has_endpoints_in_status 127.0.0.1:19000 failover-target~s2.default.primary-to-alpha.external HEALTHY 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "s1 upstream should be able to connect to s2" {
|
@test "s1 upstream should be able to connect to s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream made 1 connection" {
|
@test "s1 upstream made 1 connection" {
|
||||||
|
@ -68,7 +67,6 @@ load helpers
|
||||||
assert_service_has_healthy_instances s2 0 primary
|
assert_service_has_healthy_instances s2 0 primary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "s1 upstream should have healthy endpoints for s2 in the failover cluster peer" {
|
@test "s1 upstream should have healthy endpoints for s2 in the failover cluster peer" {
|
||||||
assert_upstream_has_endpoints_in_status 127.0.0.1:19000 failover-target~s2.default.primary.internal UNHEALTHY 1
|
assert_upstream_has_endpoints_in_status 127.0.0.1:19000 failover-target~s2.default.primary.internal UNHEALTHY 1
|
||||||
assert_upstream_has_endpoints_in_status 127.0.0.1:19000 failover-target~s2.default.primary-to-alpha.external HEALTHY 1
|
assert_upstream_has_endpoints_in_status 127.0.0.1:19000 failover-target~s2.default.primary-to-alpha.external HEALTHY 1
|
||||||
|
@ -85,7 +83,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2 in the failover cluster peer" {
|
@test "s1 upstream should be able to connect to s2 in the failover cluster peer" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream made 1 connection to s2 through the cluster peer" {
|
@test "s1 upstream made 1 connection to s2 through the cluster peer" {
|
||||||
|
@ -105,7 +103,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2 via virtual-s2" {
|
@test "s1 upstream should be able to connect to s2 via virtual-s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:5001
|
run retry_default curl -s -f -d hello localhost:5001
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream made 1 connection to s2 via virtual-s2 through the cluster peer" {
|
@test "s1 upstream made 1 connection to s2 via virtual-s2 through the cluster peer" {
|
||||||
|
|
|
@ -37,10 +37,9 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to its upstream simply" {
|
@test "s1 upstream should be able to connect to its upstream simply" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream should be able to connect to s3 via upstream s2" {
|
@test "s1 upstream should be able to connect to s3 via upstream s2" {
|
||||||
assert_expected_fortio_name s3
|
assert_expected_fortio_name s3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,9 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to its upstream simply" {
|
@test "s1 upstream should be able to connect to its upstream simply" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream should be able to connect to s3 via upstream s2" {
|
@test "s1 upstream should be able to connect to s3 via upstream s2" {
|
||||||
assert_expected_fortio_name s3
|
assert_expected_fortio_name s3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2" {
|
@test "s1 upstream should be able to connect to s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream made 1 connection to s2" {
|
@test "s1 upstream made 1 connection to s2" {
|
||||||
|
|
|
@ -57,7 +57,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
||||||
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream should be able to connect to s2 via s2" {
|
@test "s1 upstream should be able to connect to s2 via s2" {
|
||||||
|
|
|
@ -49,7 +49,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
||||||
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream made 1 connection to s2" {
|
@test "s1 upstream made 1 connection to s2" {
|
||||||
|
|
|
@ -49,7 +49,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2" {
|
@test "s1 upstream should be able to connect to s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream should be able to connect to s3 via s2 due to redirect" {
|
@test "s1 upstream should be able to connect to s3 via s2 due to redirect" {
|
||||||
|
|
|
@ -49,7 +49,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2" {
|
@test "s1 upstream should be able to connect to s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream made 1 connection to s2" {
|
@test "s1 upstream made 1 connection to s2" {
|
||||||
|
|
|
@ -33,7 +33,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2" {
|
@test "s1 upstream should be able to connect to s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s2 exposes checks on a new listener" {
|
@test "s2 exposes checks on a new listener" {
|
||||||
|
|
|
@ -24,17 +24,17 @@ load helpers
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "gateway-primary should have healthy endpoints for secondary" {
|
@test "gateway-primary should have healthy endpoints for secondary" {
|
||||||
assert_upstream_has_endpoints_in_status 127.0.0.1:19002 secondary HEALTHY 1
|
assert_upstream_has_endpoints_in_status 127.0.0.1:19002 secondary HEALTHY 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "gateway-secondary should have healthy endpoints for s2" {
|
@test "gateway-secondary should have healthy endpoints for s2" {
|
||||||
assert_upstream_has_endpoints_in_status consul-secondary-client:19003 s2 HEALTHY 1
|
assert_upstream_has_endpoints_in_status consul-secondary-client:19003 s2 HEALTHY 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream should be able to connect to s2" {
|
@test "s1 upstream should be able to connect to s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream made 1 connection" {
|
@test "s1 upstream made 1 connection" {
|
||||||
|
|
|
@ -22,7 +22,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2" {
|
@test "s1 upstream should be able to connect to s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream made 1 connection" {
|
@test "s1 upstream made 1 connection" {
|
||||||
|
|
|
@ -30,13 +30,13 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
||||||
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 proxy should have been configured with http connection managers" {
|
@test "s1 proxy should have been configured with http connection managers" {
|
||||||
LISTEN_FILTERS=$(get_envoy_listener_filters localhost:19000)
|
LISTEN_FILTERS=$(get_envoy_listener_filters localhost:19000)
|
||||||
PUB=$(echo "$LISTEN_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ' )
|
PUB=$(echo "$LISTEN_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ')
|
||||||
UPS=$(echo "$LISTEN_FILTERS" | grep -E "^(default\/default\/)?s2:" | cut -f 2 -d ' ' )
|
UPS=$(echo "$LISTEN_FILTERS" | grep -E "^(default\/default\/)?s2:" | cut -f 2 -d ' ')
|
||||||
|
|
||||||
echo "LISTEN_FILTERS = $LISTEN_FILTERS"
|
echo "LISTEN_FILTERS = $LISTEN_FILTERS"
|
||||||
echo "PUB = $PUB"
|
echo "PUB = $PUB"
|
||||||
|
@ -48,7 +48,7 @@ load helpers
|
||||||
|
|
||||||
@test "s2 proxy should have been configured with an http connection manager" {
|
@test "s2 proxy should have been configured with an http connection manager" {
|
||||||
LISTEN_FILTERS=$(get_envoy_listener_filters localhost:19001)
|
LISTEN_FILTERS=$(get_envoy_listener_filters localhost:19001)
|
||||||
PUB=$(echo "$LISTEN_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ' )
|
PUB=$(echo "$LISTEN_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ')
|
||||||
|
|
||||||
echo "LISTEN_FILTERS = $LISTEN_FILTERS"
|
echo "LISTEN_FILTERS = $LISTEN_FILTERS"
|
||||||
echo "PUB = $PUB"
|
echo "PUB = $PUB"
|
||||||
|
@ -58,8 +58,8 @@ load helpers
|
||||||
|
|
||||||
@test "s1 proxy should have been configured with http rbac filters" {
|
@test "s1 proxy should have been configured with http rbac filters" {
|
||||||
HTTP_FILTERS=$(get_envoy_http_filters localhost:19000)
|
HTTP_FILTERS=$(get_envoy_http_filters localhost:19000)
|
||||||
PUB=$(echo "$HTTP_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ' )
|
PUB=$(echo "$HTTP_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ')
|
||||||
UPS=$(echo "$HTTP_FILTERS" | grep -E "^(default\/default\/)?s2:" | cut -f 2 -d ' ' )
|
UPS=$(echo "$HTTP_FILTERS" | grep -E "^(default\/default\/)?s2:" | cut -f 2 -d ' ')
|
||||||
|
|
||||||
echo "HTTP_FILTERS = $HTTP_FILTERS"
|
echo "HTTP_FILTERS = $HTTP_FILTERS"
|
||||||
echo "PUB = $PUB"
|
echo "PUB = $PUB"
|
||||||
|
@ -71,7 +71,7 @@ load helpers
|
||||||
|
|
||||||
@test "s2 proxy should have been configured with http rbac filters" {
|
@test "s2 proxy should have been configured with http rbac filters" {
|
||||||
HTTP_FILTERS=$(get_envoy_http_filters localhost:19001)
|
HTTP_FILTERS=$(get_envoy_http_filters localhost:19001)
|
||||||
PUB=$(echo "$HTTP_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ' )
|
PUB=$(echo "$HTTP_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ')
|
||||||
|
|
||||||
echo "HTTP_FILTERS = $HTTP_FILTERS"
|
echo "HTTP_FILTERS = $HTTP_FILTERS"
|
||||||
echo "PUB = $PUB"
|
echo "PUB = $PUB"
|
||||||
|
|
|
@ -42,5 +42,5 @@ load helpers
|
||||||
@test "ingress should be able to connect to s1 via configured port" {
|
@test "ingress should be able to connect to s1 via configured port" {
|
||||||
run retry_default curl -s -f -d hello localhost:9999
|
run retry_default curl -s -f -d hello localhost:9999
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ load helpers
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "ingress-gateway should have healthy endpoints for s1" {
|
@test "ingress-gateway should have healthy endpoints for s1" {
|
||||||
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s1 HEALTHY 1
|
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s1 HEALTHY 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "should be able to connect to s1 through the TLS-enabled ingress port" {
|
@test "should be able to connect to s1 through the TLS-enabled ingress port" {
|
||||||
|
@ -30,7 +30,7 @@ load helpers
|
||||||
--resolve s1.ingress.consul:9998:127.0.0.1 \
|
--resolve s1.ingress.consul:9998:127.0.0.1 \
|
||||||
https://s1.ingress.consul:9998
|
https://s1.ingress.consul:9998
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "should be able to connect to s1 through the TLS-enabled ingress port using the custom host" {
|
@test "should be able to connect to s1 through the TLS-enabled ingress port using the custom host" {
|
||||||
|
@ -39,5 +39,5 @@ load helpers
|
||||||
--resolve test.example.com:9999:127.0.0.1 \
|
--resolve test.example.com:9999:127.0.0.1 \
|
||||||
https://test.example.com:9999
|
https://test.example.com:9999
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,21 +19,21 @@ load helpers
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "gateway-primary should have healthy endpoints for secondary" {
|
@test "gateway-primary should have healthy endpoints for secondary" {
|
||||||
assert_upstream_has_endpoints_in_status 127.0.0.1:19002 secondary HEALTHY 1
|
assert_upstream_has_endpoints_in_status 127.0.0.1:19002 secondary HEALTHY 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "gateway-secondary should have healthy endpoints for s1" {
|
@test "gateway-secondary should have healthy endpoints for s1" {
|
||||||
assert_upstream_has_endpoints_in_status consul-secondary-client:19003 s1 HEALTHY 1
|
assert_upstream_has_endpoints_in_status consul-secondary-client:19003 s1 HEALTHY 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "gateway-secondary should have healthy endpoints for s2" {
|
@test "gateway-secondary should have healthy endpoints for s2" {
|
||||||
assert_upstream_has_endpoints_in_status consul-secondary-client:19003 s2 HEALTHY 1
|
assert_upstream_has_endpoints_in_status consul-secondary-client:19003 s2 HEALTHY 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "ingress should be able to connect to s1" {
|
@test "ingress should be able to connect to s1" {
|
||||||
run retry_default curl -s -f -d hello localhost:10000
|
run retry_default curl -s -f -d hello localhost:10000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "ingress made 1 connection to s1" {
|
@test "ingress made 1 connection to s1" {
|
||||||
|
@ -47,7 +47,7 @@ load helpers
|
||||||
@test "ingress should be able to connect to s2" {
|
@test "ingress should be able to connect to s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:9999
|
run retry_default curl -s -f -d hello localhost:9999
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "ingress made 1 connection to s2" {
|
@test "ingress made 1 connection to s2" {
|
||||||
|
|
|
@ -21,7 +21,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2" {
|
@test "s1 upstream should be able to connect to s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream made 1 connection" {
|
@test "s1 upstream made 1 connection" {
|
||||||
|
@ -40,4 +40,4 @@ load helpers
|
||||||
echo "KEY_TYPE: $KEY_TYPE"
|
echo "KEY_TYPE: $KEY_TYPE"
|
||||||
|
|
||||||
[ "$KEY_TYPE" == "rsa" ]
|
[ "$KEY_TYPE" == "rsa" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
||||||
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 proxy should be exposing metrics to prometheus" {
|
@test "s1 proxy should be exposing metrics to prometheus" {
|
||||||
|
|
|
@ -30,7 +30,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
@test "s1 upstream should be able to connect to s2 with http/1.1" {
|
||||||
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
run retry_default curl --http1.1 -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 proxy should be exposing the /stats prefix" {
|
@test "s1 proxy should be exposing the /stats prefix" {
|
||||||
|
@ -47,16 +47,16 @@ load helpers
|
||||||
|
|
||||||
# Response should include the http public listener.
|
# Response should include the http public listener.
|
||||||
retry_default \
|
retry_default \
|
||||||
must_match_in_stats_proxy_response localhost:1239 \
|
must_match_in_stats_proxy_response localhost:1239 \
|
||||||
'stats' 'http.public_listener'
|
'stats' 'http.public_listener'
|
||||||
|
|
||||||
# /stats/prometheus should also be reachable and labelling the local cluster.
|
# /stats/prometheus should also be reachable and labelling the local cluster.
|
||||||
retry_default \
|
retry_default \
|
||||||
must_match_in_stats_proxy_response localhost:1239 \
|
must_match_in_stats_proxy_response localhost:1239 \
|
||||||
'stats/prometheus' '[\{,]consul_source_service="s1"[,}]'
|
'stats/prometheus' '[\{,]consul_source_service="s1"[,}]'
|
||||||
|
|
||||||
# /stats/prometheus should also be reachable and exposing metrics.
|
# /stats/prometheus should also be reachable and exposing metrics.
|
||||||
retry_default \
|
retry_default \
|
||||||
must_match_in_stats_proxy_response localhost:1239 \
|
must_match_in_stats_proxy_response localhost:1239 \
|
||||||
'stats/prometheus' 'envoy_http_downstream_rq_active'
|
'stats/prometheus' 'envoy_http_downstream_rq_active'
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ load helpers
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "terminating-gateway should have healthy endpoints for s4" {
|
@test "terminating-gateway should have healthy endpoints for s4" {
|
||||||
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s4 HEALTHY 1
|
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s4 HEALTHY 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream should have healthy endpoints for s4" {
|
@test "s1 upstream should have healthy endpoints for s4" {
|
||||||
|
@ -25,7 +25,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s4" {
|
@test "s1 upstream should be able to connect to s4" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "terminating-gateway is used for the upstream connection" {
|
@test "terminating-gateway is used for the upstream connection" {
|
||||||
|
|
|
@ -15,7 +15,7 @@ load helpers
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "terminating-gateway should have healthy endpoints for s2" {
|
@test "terminating-gateway should have healthy endpoints for s2" {
|
||||||
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s2 HEALTHY 1
|
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s2 HEALTHY 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "s1 upstream should have healthy endpoints for s2" {
|
@test "s1 upstream should have healthy endpoints for s2" {
|
||||||
|
@ -25,7 +25,7 @@ load helpers
|
||||||
@test "s1 upstream should be able to connect to s2" {
|
@test "s1 upstream should be able to connect to s2" {
|
||||||
run retry_default curl -s -f -d hello localhost:5000
|
run retry_default curl -s -f -d hello localhost:5000
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "terminating-gateway is used for the upstream connection" {
|
@test "terminating-gateway is used for the upstream connection" {
|
||||||
|
|
|
@ -11,18 +11,14 @@ function retry {
|
||||||
shift
|
shift
|
||||||
|
|
||||||
local errtrace=0
|
local errtrace=0
|
||||||
if grep -q "errtrace" <<< "$SHELLOPTS"
|
if grep -q "errtrace" <<<"$SHELLOPTS"; then
|
||||||
then
|
|
||||||
errtrace=1
|
errtrace=1
|
||||||
set +E
|
set +E
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for ((i=1;i<=$max;i++))
|
for ((i = 1; i <= $max; i++)); do
|
||||||
do
|
if "$@"; then
|
||||||
if "$@"
|
if test $errtrace -eq 1; then
|
||||||
then
|
|
||||||
if test $errtrace -eq 1
|
|
||||||
then
|
|
||||||
set -E
|
set -E
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
|
@ -32,8 +28,7 @@ function retry {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if test $errtrace -eq 1
|
if test $errtrace -eq 1; then
|
||||||
then
|
|
||||||
set -E
|
set -E
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
|
@ -52,22 +47,22 @@ function retry_long {
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_set {
|
function is_set {
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# $1 - string value to check its truthiness
|
# $1 - string value to check its truthiness
|
||||||
#
|
#
|
||||||
# Return:
|
# Return:
|
||||||
# 0 - is truthy (backwards I know but allows syntax like `if is_set <var>` to work)
|
# 0 - is truthy (backwards I know but allows syntax like `if is_set <var>` to work)
|
||||||
# 1 - is not truthy
|
# 1 - is not truthy
|
||||||
|
|
||||||
local val=$(tr '[:upper:]' '[:lower:]' <<< "$1")
|
local val=$(tr '[:upper:]' '[:lower:]' <<<"$1")
|
||||||
case $val in
|
case $val in
|
||||||
1 | t | true | y | yes)
|
1 | t | true | y | yes)
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_cert {
|
function get_cert {
|
||||||
|
@ -79,7 +74,7 @@ function get_cert {
|
||||||
SNI_FLAG="-servername $SERVER_NAME"
|
SNI_FLAG="-servername $SERVER_NAME"
|
||||||
fi
|
fi
|
||||||
CERT=$(openssl s_client -connect $HOSTPORT $SNI_FLAG -showcerts </dev/null)
|
CERT=$(openssl s_client -connect $HOSTPORT $SNI_FLAG -showcerts </dev/null)
|
||||||
openssl x509 -noout -text <<< "$CERT"
|
openssl x509 -noout -text <<<"$CERT"
|
||||||
}
|
}
|
||||||
|
|
||||||
function assert_proxy_presents_cert_uri {
|
function assert_proxy_presents_cert_uri {
|
||||||
|
@ -140,7 +135,7 @@ function assert_envoy_version {
|
||||||
# Envoy 1.8.0 returns a plain text line like
|
# Envoy 1.8.0 returns a plain text line like
|
||||||
# envoy 5d25f466c3410c0dfa735d7d4358beb76b2da507/1.8.0/Clean/DEBUG live 3 3 0
|
# envoy 5d25f466c3410c0dfa735d7d4358beb76b2da507/1.8.0/Clean/DEBUG live 3 3 0
|
||||||
# Later versions return JSON.
|
# Later versions return JSON.
|
||||||
if (echo $output | grep '^envoy') ; then
|
if (echo $output | grep '^envoy'); then
|
||||||
VERSION=$(echo $output | cut -d ' ' -f 2)
|
VERSION=$(echo $output | cut -d ' ' -f 2)
|
||||||
else
|
else
|
||||||
VERSION=$(echo $output | jq -r '.version')
|
VERSION=$(echo $output | jq -r '.version')
|
||||||
|
@ -153,11 +148,11 @@ function assert_envoy_version {
|
||||||
|
|
||||||
# 1.20.2, 1.19.3 and 1.18.6 are special snowflakes in that the version for
|
# 1.20.2, 1.19.3 and 1.18.6 are special snowflakes in that the version for
|
||||||
# the release is reported with a '-dev' suffix (eg 1.20.2-dev).
|
# the release is reported with a '-dev' suffix (eg 1.20.2-dev).
|
||||||
if [ "$ENVOY_VERSION" = "1.20.2" ] ; then
|
if [ "$ENVOY_VERSION" = "1.20.2" ]; then
|
||||||
ENVOY_VERSION="1.20.2-dev"
|
ENVOY_VERSION="1.20.2-dev"
|
||||||
elif [ "$ENVOY_VERSION" = "1.19.3" ] ; then
|
elif [ "$ENVOY_VERSION" = "1.19.3" ]; then
|
||||||
ENVOY_VERSION="1.19.3-dev"
|
ENVOY_VERSION="1.19.3-dev"
|
||||||
elif [ "$ENVOY_VERSION" = "1.18.6" ] ; then
|
elif [ "$ENVOY_VERSION" = "1.18.6" ]; then
|
||||||
ENVOY_VERSION="1.18.6-dev"
|
ENVOY_VERSION="1.18.6-dev"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -298,10 +293,10 @@ function snapshot_envoy_admin {
|
||||||
local OUTDIR="${LOG_DIR}/envoy-snapshots/${DC}/${ENVOY_NAME}"
|
local OUTDIR="${LOG_DIR}/envoy-snapshots/${DC}/${ENVOY_NAME}"
|
||||||
|
|
||||||
mkdir -p "${OUTDIR}"
|
mkdir -p "${OUTDIR}"
|
||||||
docker_wget "$DC" "http://${HOSTPORT}/config_dump" -q -O - > "${OUTDIR}/config_dump.json"
|
docker_wget "$DC" "http://${HOSTPORT}/config_dump" -q -O - >"${OUTDIR}/config_dump.json"
|
||||||
docker_wget "$DC" "http://${HOSTPORT}/clusters?format=json" -q -O - > "${OUTDIR}/clusters.json"
|
docker_wget "$DC" "http://${HOSTPORT}/clusters?format=json" -q -O - >"${OUTDIR}/clusters.json"
|
||||||
docker_wget "$DC" "http://${HOSTPORT}/stats" -q -O - > "${OUTDIR}/stats.txt"
|
docker_wget "$DC" "http://${HOSTPORT}/stats" -q -O - >"${OUTDIR}/stats.txt"
|
||||||
docker_wget "$DC" "http://${HOSTPORT}/stats/prometheus" -q -O - > "${OUTDIR}/stats_prometheus.txt"
|
docker_wget "$DC" "http://${HOSTPORT}/stats/prometheus" -q -O - >"${OUTDIR}/stats_prometheus.txt"
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset_envoy_metrics {
|
function reset_envoy_metrics {
|
||||||
|
@ -365,22 +360,19 @@ function assert_envoy_metric {
|
||||||
|
|
||||||
METRICS=$(get_envoy_metrics $HOSTPORT "$METRIC")
|
METRICS=$(get_envoy_metrics $HOSTPORT "$METRIC")
|
||||||
|
|
||||||
if [ -z "${METRICS}" ]
|
if [ -z "${METRICS}" ]; then
|
||||||
then
|
|
||||||
echo "Metric not found" 1>&2
|
echo "Metric not found" 1>&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GOT_COUNT=$(awk -F: '{print $2}' <<< "$METRICS" | head -n 1 | tr -d ' ')
|
GOT_COUNT=$(awk -F: '{print $2}' <<<"$METRICS" | head -n 1 | tr -d ' ')
|
||||||
|
|
||||||
if [ -z "$GOT_COUNT" ]
|
if [ -z "$GOT_COUNT" ]; then
|
||||||
then
|
|
||||||
echo "Couldn't parse metric count" 1>&2
|
echo "Couldn't parse metric count" 1>&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $EXPECT_COUNT -ne $GOT_COUNT ]
|
if [ $EXPECT_COUNT -ne $GOT_COUNT ]; then
|
||||||
then
|
|
||||||
echo "$METRIC - expected count: $EXPECT_COUNT, actual count: $GOT_COUNT" 1>&2
|
echo "$METRIC - expected count: $EXPECT_COUNT, actual count: $GOT_COUNT" 1>&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -394,22 +386,19 @@ function assert_envoy_metric_at_least {
|
||||||
|
|
||||||
METRICS=$(get_envoy_metrics $HOSTPORT "$METRIC")
|
METRICS=$(get_envoy_metrics $HOSTPORT "$METRIC")
|
||||||
|
|
||||||
if [ -z "${METRICS}" ]
|
if [ -z "${METRICS}" ]; then
|
||||||
then
|
|
||||||
echo "Metric not found" 1>&2
|
echo "Metric not found" 1>&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GOT_COUNT=$(awk -F: '{print $2}' <<< "$METRICS" | head -n 1 | tr -d ' ')
|
GOT_COUNT=$(awk -F: '{print $2}' <<<"$METRICS" | head -n 1 | tr -d ' ')
|
||||||
|
|
||||||
if [ -z "$GOT_COUNT" ]
|
if [ -z "$GOT_COUNT" ]; then
|
||||||
then
|
|
||||||
echo "Couldn't parse metric count" 1>&2
|
echo "Couldn't parse metric count" 1>&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $EXPECT_COUNT -gt $GOT_COUNT ]
|
if [ $EXPECT_COUNT -gt $GOT_COUNT ]; then
|
||||||
then
|
|
||||||
echo "$METRIC - expected >= count: $EXPECT_COUNT, actual count: $GOT_COUNT" 1>&2
|
echo "$METRIC - expected >= count: $EXPECT_COUNT, actual count: $GOT_COUNT" 1>&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -423,22 +412,19 @@ function assert_envoy_aggregate_metric_at_least {
|
||||||
|
|
||||||
METRICS=$(get_envoy_metrics $HOSTPORT "$METRIC")
|
METRICS=$(get_envoy_metrics $HOSTPORT "$METRIC")
|
||||||
|
|
||||||
if [ -z "${METRICS}" ]
|
if [ -z "${METRICS}" ]; then
|
||||||
then
|
|
||||||
echo "Metric not found" 1>&2
|
echo "Metric not found" 1>&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GOT_COUNT=$(awk '{ sum += $2 } END { print sum }' <<< "$METRICS")
|
GOT_COUNT=$(awk '{ sum += $2 } END { print sum }' <<<"$METRICS")
|
||||||
|
|
||||||
if [ -z "$GOT_COUNT" ]
|
if [ -z "$GOT_COUNT" ]; then
|
||||||
then
|
|
||||||
echo "Couldn't parse metric count" 1>&2
|
echo "Couldn't parse metric count" 1>&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $EXPECT_COUNT -gt $GOT_COUNT ]
|
if [ $EXPECT_COUNT -gt $GOT_COUNT ]; then
|
||||||
then
|
|
||||||
echo "$METRIC - expected >= count: $EXPECT_COUNT, actual count: $GOT_COUNT" 1>&2
|
echo "$METRIC - expected >= count: $EXPECT_COUNT, actual count: $GOT_COUNT" 1>&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -541,7 +527,7 @@ function docker_consul_for_proxy_bootstrap {
|
||||||
local DC=$1
|
local DC=$1
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
docker run -i --rm --network container:envoy_consul-${DC}_1 consul:local "$@" 2> /dev/null
|
docker run -i --rm --network container:envoy_consul-${DC}_1 consul:local "$@" 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
function docker_wget {
|
function docker_wget {
|
||||||
|
@ -557,8 +543,7 @@ function docker_curl {
|
||||||
}
|
}
|
||||||
|
|
||||||
function docker_exec {
|
function docker_exec {
|
||||||
if ! docker exec -i "$@"
|
if ! docker exec -i "$@"; then
|
||||||
then
|
|
||||||
echo "Failed to execute: docker exec -i $@" 1>&2
|
echo "Failed to execute: docker exec -i $@" 1>&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -582,7 +567,7 @@ function must_match_in_statsd_logs {
|
||||||
|
|
||||||
run cat /workdir/${DC}/statsd/statsd.log
|
run cat /workdir/${DC}/statsd/statsd.log
|
||||||
echo "$output"
|
echo "$output"
|
||||||
COUNT=$( echo "$output" | grep -Ec $1 )
|
COUNT=$(echo "$output" | grep -Ec $1)
|
||||||
|
|
||||||
echo "COUNT of '$1' matches: $COUNT"
|
echo "COUNT of '$1' matches: $COUNT"
|
||||||
|
|
||||||
|
@ -592,7 +577,7 @@ function must_match_in_statsd_logs {
|
||||||
|
|
||||||
function must_match_in_prometheus_response {
|
function must_match_in_prometheus_response {
|
||||||
run curl -f -s $1/metrics
|
run curl -f -s $1/metrics
|
||||||
COUNT=$( echo "$output" | grep -Ec $2 )
|
COUNT=$(echo "$output" | grep -Ec $2)
|
||||||
|
|
||||||
echo "OUTPUT head -n 10"
|
echo "OUTPUT head -n 10"
|
||||||
echo "$output" | head -n 10
|
echo "$output" | head -n 10
|
||||||
|
@ -604,7 +589,7 @@ function must_match_in_prometheus_response {
|
||||||
|
|
||||||
function must_match_in_stats_proxy_response {
|
function must_match_in_stats_proxy_response {
|
||||||
run curl -f -s $1/$2
|
run curl -f -s $1/$2
|
||||||
COUNT=$( echo "$output" | grep -Ec $3 )
|
COUNT=$(echo "$output" | grep -Ec $3)
|
||||||
|
|
||||||
echo "OUTPUT head -n 10"
|
echo "OUTPUT head -n 10"
|
||||||
echo "$output" | head -n 10
|
echo "$output" | head -n 10
|
||||||
|
@ -638,7 +623,7 @@ function must_pass_tcp_connection {
|
||||||
echo "OUTPUT $output"
|
echo "OUTPUT $output"
|
||||||
|
|
||||||
[ "$status" == "0" ]
|
[ "$status" == "0" ]
|
||||||
[ "$output" = "hello" ]
|
[[ "$output" == *"hello"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
# must_fail_http_connection see must_fail_tcp_connection but this expects Envoy
|
# must_fail_http_connection see must_fail_tcp_connection but this expects Envoy
|
||||||
|
@ -669,17 +654,17 @@ function must_pass_http_request {
|
||||||
extra_args="-H x-test-debug:${DEBUG_HEADER_VALUE}"
|
extra_args="-H x-test-debug:${DEBUG_HEADER_VALUE}"
|
||||||
fi
|
fi
|
||||||
case "$METHOD" in
|
case "$METHOD" in
|
||||||
GET)
|
GET) ;;
|
||||||
;;
|
|
||||||
DELETE)
|
DELETE)
|
||||||
extra_args="$extra_args -X${METHOD}"
|
extra_args="$extra_args -X${METHOD}"
|
||||||
;;
|
;;
|
||||||
PUT|POST)
|
PUT | POST)
|
||||||
extra_args="$extra_args -d'{}' -X${METHOD}"
|
extra_args="$extra_args -d'{}' -X${METHOD}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
run curl --no-keepalive -v -s -f $extra_args "$URL"
|
run curl --no-keepalive -v -s -f $extra_args "$URL"
|
||||||
|
@ -696,23 +681,23 @@ function must_fail_http_request {
|
||||||
|
|
||||||
local extra_args
|
local extra_args
|
||||||
if [[ -n "${DEBUG_HEADER_VALUE}" ]]; then
|
if [[ -n "${DEBUG_HEADER_VALUE}" ]]; then
|
||||||
extra_args="-H x-test-debug:${DEBUG_HEADER_VALUE}"
|
extra_args="-H x-test-debug:${DEBUG_HEADER_VALUE}"
|
||||||
fi
|
fi
|
||||||
case "$METHOD" in
|
case "$METHOD" in
|
||||||
HEAD)
|
HEAD)
|
||||||
extra_args="$extra_args -I"
|
extra_args="$extra_args -I"
|
||||||
;;
|
;;
|
||||||
GET)
|
GET) ;;
|
||||||
;;
|
|
||||||
DELETE)
|
DELETE)
|
||||||
extra_args="$extra_args -X${METHOD}"
|
extra_args="$extra_args -X${METHOD}"
|
||||||
;;
|
;;
|
||||||
PUT|POST)
|
PUT | POST)
|
||||||
extra_args="$extra_args -d'{}' -X${METHOD}"
|
extra_args="$extra_args -d'{}' -X${METHOD}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Attempt to curl through upstream
|
# Attempt to curl through upstream
|
||||||
|
@ -731,8 +716,7 @@ function gen_envoy_bootstrap {
|
||||||
EXTRA_ENVOY_BS_ARGS="${5-}"
|
EXTRA_ENVOY_BS_ARGS="${5-}"
|
||||||
|
|
||||||
PROXY_ID="$SERVICE"
|
PROXY_ID="$SERVICE"
|
||||||
if ! is_set "$IS_GW"
|
if ! is_set "$IS_GW"; then
|
||||||
then
|
|
||||||
PROXY_ID="$SERVICE-sidecar-proxy"
|
PROXY_ID="$SERVICE-sidecar-proxy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -742,7 +726,7 @@ function gen_envoy_bootstrap {
|
||||||
-admin-bind 0.0.0.0:$ADMIN_PORT ${EXTRA_ENVOY_BS_ARGS} 2>&1); then
|
-admin-bind 0.0.0.0:$ADMIN_PORT ${EXTRA_ENVOY_BS_ARGS} 2>&1); then
|
||||||
|
|
||||||
# All OK, write config to file
|
# All OK, write config to file
|
||||||
echo "$output" > workdir/${DC}/envoy/$SERVICE-bootstrap.json
|
echo "$output" >workdir/${DC}/envoy/$SERVICE-bootstrap.json
|
||||||
else
|
else
|
||||||
status=$?
|
status=$?
|
||||||
# Command failed, instead of swallowing error (printed on stdout by docker
|
# Command failed, instead of swallowing error (printed on stdout by docker
|
||||||
|
@ -794,7 +778,7 @@ function setup_upsert_l4_intention {
|
||||||
local ACTION=$3
|
local ACTION=$3
|
||||||
|
|
||||||
retry_default docker_curl primary -sL -XPUT "http://127.0.0.1:8500/v1/connect/intentions/exact?source=${SOURCE}&destination=${DESTINATION}" \
|
retry_default docker_curl primary -sL -XPUT "http://127.0.0.1:8500/v1/connect/intentions/exact?source=${SOURCE}&destination=${DESTINATION}" \
|
||||||
-d"{\"Action\": \"${ACTION}\"}" >/dev/null
|
-d"{\"Action\": \"${ACTION}\"}" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
function upsert_l4_intention {
|
function upsert_l4_intention {
|
||||||
|
@ -803,7 +787,7 @@ function upsert_l4_intention {
|
||||||
local ACTION=$3
|
local ACTION=$3
|
||||||
|
|
||||||
retry_default curl -sL -XPUT "http://127.0.0.1:8500/v1/connect/intentions/exact?source=${SOURCE}&destination=${DESTINATION}" \
|
retry_default curl -sL -XPUT "http://127.0.0.1:8500/v1/connect/intentions/exact?source=${SOURCE}&destination=${DESTINATION}" \
|
||||||
-d"{\"Action\": \"${ACTION}\"}" >/dev/null
|
-d"{\"Action\": \"${ACTION}\"}" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_ca_root {
|
function get_ca_root {
|
||||||
|
@ -822,15 +806,16 @@ function set_ttl_check_state {
|
||||||
local DC=${3:-primary}
|
local DC=${3:-primary}
|
||||||
|
|
||||||
case "$CHECK_STATE" in
|
case "$CHECK_STATE" in
|
||||||
pass)
|
pass) ;;
|
||||||
;;
|
|
||||||
warn)
|
warn) ;;
|
||||||
;;
|
|
||||||
fail)
|
fail) ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "invalid ttl check state '${CHECK_STATE}'" >&2
|
echo "invalid ttl check state '${CHECK_STATE}'" >&2
|
||||||
return 1
|
return 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
retry_default docker_curl "${DC}" -sL -XPUT "http://localhost:8500/v1/agent/check/warn/${CHECK_ID}"
|
retry_default docker_curl "${DC}" -sL -XPUT "http://localhost:8500/v1/agent/check/warn/${CHECK_ID}"
|
||||||
|
@ -843,7 +828,7 @@ function get_upstream_fortio_name {
|
||||||
local DEBUG_HEADER_VALUE="${4:-""}"
|
local DEBUG_HEADER_VALUE="${4:-""}"
|
||||||
local extra_args
|
local extra_args
|
||||||
if [[ -n "${DEBUG_HEADER_VALUE}" ]]; then
|
if [[ -n "${DEBUG_HEADER_VALUE}" ]]; then
|
||||||
extra_args="-H x-test-debug:${DEBUG_HEADER_VALUE}"
|
extra_args="-H x-test-debug:${DEBUG_HEADER_VALUE}"
|
||||||
fi
|
fi
|
||||||
# split proto if https:// is at the front of the host since the --resolve
|
# split proto if https:// is at the front of the host since the --resolve
|
||||||
# string needs just a bare host.
|
# string needs just a bare host.
|
||||||
|
@ -857,7 +842,7 @@ function get_upstream_fortio_name {
|
||||||
# We use --resolve instead of setting a Host header since we need the right
|
# We use --resolve instead of setting a Host header since we need the right
|
||||||
# name to be sent for SNI in some cases too.
|
# name to be sent for SNI in some cases too.
|
||||||
run retry_default curl -v -s -f --resolve "${HOST}:${PORT}:127.0.0.1" $extra_args \
|
run retry_default curl -v -s -f --resolve "${HOST}:${PORT}:127.0.0.1" $extra_args \
|
||||||
"${PROTO}${HOST}:${PORT}${PREFIX}/debug?env=dump"
|
"${PROTO}${HOST}:${PORT}${PREFIX}/debug?env=dump"
|
||||||
|
|
||||||
# Useful Debugging but breaks the expectation that the value output is just
|
# Useful Debugging but breaks the expectation that the value output is just
|
||||||
# the grep output when things don't fail
|
# the grep output when things don't fail
|
||||||
|
@ -893,7 +878,7 @@ function assert_expected_fortio_name_pattern {
|
||||||
GOT=$(get_upstream_fortio_name ${HOST} ${PORT} "${URL_PREFIX}" "${DEBUG_HEADER_VALUE}")
|
GOT=$(get_upstream_fortio_name ${HOST} ${PORT} "${URL_PREFIX}" "${DEBUG_HEADER_VALUE}")
|
||||||
|
|
||||||
if [[ "$GOT" =~ $EXPECT_NAME_PATTERN ]]; then
|
if [[ "$GOT" =~ $EXPECT_NAME_PATTERN ]]; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
echo "expected name pattern: $EXPECT_NAME_PATTERN, actual name: $GOT" 1>&2
|
echo "expected name pattern: $EXPECT_NAME_PATTERN, actual name: $GOT" 1>&2
|
||||||
return 1
|
return 1
|
||||||
|
@ -907,10 +892,10 @@ function get_upstream_fortio_host_header {
|
||||||
local DEBUG_HEADER_VALUE="${4:-""}"
|
local DEBUG_HEADER_VALUE="${4:-""}"
|
||||||
local extra_args
|
local extra_args
|
||||||
if [[ -n "${DEBUG_HEADER_VALUE}" ]]; then
|
if [[ -n "${DEBUG_HEADER_VALUE}" ]]; then
|
||||||
extra_args="-H x-test-debug:${DEBUG_HEADER_VALUE}"
|
extra_args="-H x-test-debug:${DEBUG_HEADER_VALUE}"
|
||||||
fi
|
fi
|
||||||
run retry_default curl -v -s -f -H"Host: ${HOST}" $extra_args \
|
run retry_default curl -v -s -f -H"Host: ${HOST}" $extra_args \
|
||||||
"localhost:${PORT}${PREFIX}/debug"
|
"localhost:${PORT}${PREFIX}/debug"
|
||||||
[ "$status" == 0 ]
|
[ "$status" == 0 ]
|
||||||
echo "$output" | grep -E "^Host: "
|
echo "$output" | grep -E "^Host: "
|
||||||
}
|
}
|
||||||
|
@ -959,13 +944,13 @@ function register_lambdas {
|
||||||
local DC=${1:-primary}
|
local DC=${1:-primary}
|
||||||
# register lambdas to the catalog
|
# register lambdas to the catalog
|
||||||
for f in $(find workdir/${DC}/register -type f -name 'lambda_*.json'); do
|
for f in $(find workdir/${DC}/register -type f -name 'lambda_*.json'); do
|
||||||
retry_default curl -sL -XPUT -d @${f} "http://localhost:8500/v1/catalog/register" >/dev/null && \
|
retry_default curl -sL -XPUT -d @${f} "http://localhost:8500/v1/catalog/register" >/dev/null &&
|
||||||
echo "Registered Lambda: $(jq -r .Service.Service $f)"
|
echo "Registered Lambda: $(jq -r .Service.Service $f)"
|
||||||
done
|
done
|
||||||
# write service-defaults config entries for lambdas
|
# write service-defaults config entries for lambdas
|
||||||
for f in $(find workdir/${DC}/register -type f -name 'service_defaults_*.json'); do
|
for f in $(find workdir/${DC}/register -type f -name 'service_defaults_*.json'); do
|
||||||
varsub ${f} AWS_LAMBDA_REGION AWS_LAMBDA_ARN
|
varsub ${f} AWS_LAMBDA_REGION AWS_LAMBDA_ARN
|
||||||
retry_default curl -sL -XPUT -d @${f} "http://localhost:8500/v1/config" >/dev/null && \
|
retry_default curl -sL -XPUT -d @${f} "http://localhost:8500/v1/config" >/dev/null &&
|
||||||
echo "Wrote config: $(jq -r '.Kind + " / " + .Name' $f)"
|
echo "Wrote config: $(jq -r '.Kind + " / " + .Name' $f)"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -992,7 +977,8 @@ function assert_lambda_envoy_dynamic_http_filter_exists {
|
||||||
}
|
}
|
||||||
|
|
||||||
function varsub {
|
function varsub {
|
||||||
local file=$1 ; shift
|
local file=$1
|
||||||
|
shift
|
||||||
for v in "$@"; do
|
for v in "$@"; do
|
||||||
sed -i "s/\${$v}/${!v}/g" $file
|
sed -i "s/\${$v}/${!v}/g" $file
|
||||||
done
|
done
|
||||||
|
@ -1016,4 +1002,4 @@ function assert_url_header {
|
||||||
run get_url_header "$URL" "$HEADER"
|
run get_url_header "$URL" "$HEADER"
|
||||||
[ "$status" == 0 ]
|
[ "$status" == 0 ]
|
||||||
[ "$VALUE" = "$output" ]
|
[ "$VALUE" = "$output" ]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue