mirror of
https://github.com/status-im/consul.git
synced 2025-02-28 05:10:40 +00:00
[1.8.x] test: remove warnings and ensure the expose checks envoy test actually runs (#9804)
This commit is contained in:
parent
40987a2b69
commit
58f068f53a
@ -2,7 +2,5 @@
|
||||
|
||||
set -eEuo pipefail
|
||||
|
||||
register_services primary
|
||||
|
||||
gen_envoy_bootstrap s1 19000 primary
|
||||
gen_envoy_bootstrap s2 19001 primary
|
||||
|
@ -161,6 +161,26 @@ function assert_envoy_expose_checks_listener_count {
|
||||
BODY=$(get_envoy_expose_checks_listener_once $HOSTPORT)
|
||||
echo "BODY = $BODY"
|
||||
|
||||
if [[ "$ENVOY_VERSION" =~ ^1\.1[012]\. ]]; then
|
||||
CHAINS=$(echo "$BODY" | jq '.listener.filter_chains | length')
|
||||
echo "CHAINS = $CHAINS (expect 1)"
|
||||
[ "${CHAINS:-0}" -eq 1 ]
|
||||
|
||||
RANGES=$(echo "$BODY" | jq '.listener.filter_chains[0].filter_chain_match.source_prefix_ranges | length')
|
||||
echo "RANGES = $RANGES (expect 3)"
|
||||
# note: if IPv6 is not supported in the kernel per
|
||||
# agent/xds:kernelSupportsIPv6() then this will only be 2
|
||||
[ "${RANGES:-0}" -eq 3 ]
|
||||
|
||||
HCM=$(echo "$BODY" | jq '.listener.filter_chains[0].filters[0]')
|
||||
HCM_NAME=$(echo "$HCM" | jq -r '.name')
|
||||
HCM_PATH=$(echo "$HCM" | jq -r '.config.route_config.virtual_hosts[0].routes[0].match.path')
|
||||
echo "HCM = $HCM"
|
||||
[ "${HCM_NAME:-}" == "envoy.http_connection_manager" ]
|
||||
[ "${HCM_PATH:-}" == "${EXPECT_PATH}" ]
|
||||
return 0
|
||||
fi
|
||||
|
||||
CHAINS=$(echo "$BODY" | jq '.active_state.listener.filter_chains | length')
|
||||
echo "CHAINS = $CHAINS (expect 1)"
|
||||
[ "${CHAINS:-0}" -eq 1 ]
|
||||
@ -183,7 +203,11 @@ function get_envoy_expose_checks_listener_once {
|
||||
local HOSTPORT=$1
|
||||
run curl -s -f $HOSTPORT/config_dump
|
||||
[ "$status" -eq 0 ]
|
||||
echo "$output" | jq --raw-output '.configs[] | select(.["@type"] == "type.googleapis.com/envoy.admin.v3.ListenersConfigDump") | .dynamic_listeners[] | select(.name | startswith("exposed_path_"))'
|
||||
if [[ "$ENVOY_VERSION" =~ ^1\.1[012]\. ]]; then
|
||||
echo "$output" | jq --raw-output '.configs[] | select(.["@type"] == "type.googleapis.com/envoy.admin.v2alpha.ListenersConfigDump") | .dynamic_active_listeners[] | select(.listener.name | startswith("exposed_path_"))'
|
||||
else
|
||||
echo "$output" | jq --raw-output '.configs[] | select(.["@type"] == "type.googleapis.com/envoy.admin.v3.ListenersConfigDump") | .dynamic_listeners[] | select(.name | startswith("exposed_path_"))'
|
||||
fi
|
||||
}
|
||||
|
||||
function get_envoy_listener_filters {
|
||||
|
@ -26,6 +26,7 @@ func TestEnvoy(t *testing.T) {
|
||||
"case-cfg-splitter-features",
|
||||
"case-consul-exec",
|
||||
"case-dogstatsd-udp",
|
||||
"case-expose-checks",
|
||||
"case-gateways-local",
|
||||
"case-gateways-remote",
|
||||
"case-gateway-without-services",
|
||||
|
Loading…
x
Reference in New Issue
Block a user