test: add local 2x2 route topology
This commit is contained in:
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
source "$(dirname "$0")/lib.sh"
|
||||
timeout_seconds=${E2E_WAIT_SECONDS:-360}
|
||||
deadline=$((SECONDS + timeout_seconds))
|
||||
|
||||
while (( SECONDS < deadline )); do
|
||||
payload=$(compose_control run --rm --no-deps \
|
||||
--entrypoint /bin/sh curl -c \
|
||||
'curl --max-time 5 -fsS http://127.0.0.1:18081/test/v1/clients; printf "\n"; curl --max-time 5 -fsS http://127.0.0.1:18081/test/v1/routes' \
|
||||
2>/dev/null || true)
|
||||
clients=${payload%%$'\n'*}
|
||||
routes=${payload#*$'\n'}
|
||||
client_count=$(grep -o '"client_id"' <<<"$clients" | wc -l || true)
|
||||
ready_count=$(grep -o '"state":"ready"' <<<"$routes" | wc -l || true)
|
||||
if [[ "$client_count" -eq 4 && "$ready_count" -eq 4 ]]; then
|
||||
printf '2x2 route mesh ready: clients=%s ready_routes=%s\n' \
|
||||
"$client_count" "$ready_count"
|
||||
printf '%s\n' "$routes"
|
||||
exit 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
printf 'timed out waiting for 2x2 route mesh after %ss\n' \
|
||||
"$timeout_seconds" >&2
|
||||
"$E2E_ROOT/scripts/logs.sh" >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user