mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
test(multiplayer): verify result websocket fanout
This commit is contained in:
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
container_name="cosmic-clash-result-fanout-integration"
|
||||
database="cosmic_clash_test"
|
||||
user="cosmic_clash_test"
|
||||
password="cosmic_clash_test"
|
||||
|
||||
cleanup() {
|
||||
docker rm -f "$container_name" >/dev/null 2>&1 || true
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
cleanup
|
||||
docker run --rm -d --name "$container_name" \
|
||||
-e POSTGRES_DB="$database" \
|
||||
-e POSTGRES_USER="$user" \
|
||||
-e POSTGRES_PASSWORD="$password" \
|
||||
-p 55433:5432 postgres:17-alpine >/dev/null
|
||||
|
||||
for attempt in $(seq 1 30); do
|
||||
if docker exec "$container_name" pg_isready -U "$user" -d "$database" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" = 30 ]; then
|
||||
echo "PostgreSQL did not become ready" >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
cd "$repo_root/server"
|
||||
COSMIC_CLASH_POSTGRES_DSN="postgres://${user}:${password}@127.0.0.1:55433/${database}?sslmode=disable" \
|
||||
go test -tags integration ./api -run '^TestResultOutboxFanoutReachesAnAuthenticatedWebSocket$' -count=1
|
||||
Reference in New Issue
Block a user