fix(multiplayer): harden live registration verification

This commit is contained in:
Josh Creek
2026-09-04 16:48:25 +01:00
parent 482d4b0985
commit a5cbba8ac9
6 changed files with 84 additions and 15 deletions
@@ -13,7 +13,8 @@ set -euo pipefail
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$root_dir"
godot_bin="${GODOT_BIN:-godot}"
godot_bin="${GODOT_BIN:-}"
godot_image="barichello/godot-ci@sha256:622e5ca81b54cd8038ecf7de5d157b47efc800d7cf635af2eec18a6aee4bab7e"
container_name="cosmic-clash-control-plane-proposal-integration"
database="cosmic_clash_test"
user="cosmic_clash_test"
@@ -24,6 +25,27 @@ logs_dir="$(mktemp -d "${TMPDIR:-/tmp}/cosmic-clash-control-plane-proposal.XXXXX
testkit_pid=""
matcher_pid=""
if [[ -z "$godot_bin" ]]; then
if command -v godot >/dev/null 2>&1; then
godot_bin="$(command -v godot)"
elif [[ -x /Applications/Godot.app/Contents/MacOS/Godot ]]; then
godot_bin="/Applications/Godot.app/Contents/MacOS/Godot"
fi
fi
use_container_godot=0
if [[ -z "$godot_bin" || ! -x "$godot_bin" ]]; then
use_container_godot=1
fi
run_godot() {
if [[ "$use_container_godot" == 0 ]]; then
"$godot_bin" --headless --path Game res://tests/control_plane_proposal_smoke.tscn -- "$@"
return
fi
docker run --rm --platform linux/amd64 \
--mount "type=bind,src=$root_dir,dst=/workspace" -w /workspace "$godot_image" \
godot --headless --path Game res://tests/control_plane_proposal_smoke.tscn -- "$@"
}
cleanup() {
local status=$?
if (( status != 0 )); then
@@ -85,12 +107,14 @@ COSMIC_CLASH_POSTGRES_DSN="$dsn" "$logs_dir/matcher" --playlist=casual --size=2
>"$logs_dir/matcher.log" 2>&1 &
matcher_pid=$!
"$godot_bin" --headless --path Game res://tests/control_plane_proposal_smoke.tscn -- \
--control-plane-url="http://127.0.0.1:${api_port}" --role=player-a \
client_api_host="127.0.0.1"
if [[ "$use_container_godot" == 1 ]]; then
client_api_host="host.docker.internal"
fi
run_godot --control-plane-url="http://${client_api_host}:${api_port}" --role=player-a \
>"$logs_dir/godot-player-a.log" 2>&1 &
player_a_pid=$!
"$godot_bin" --headless --path Game res://tests/control_plane_proposal_smoke.tscn -- \
--control-plane-url="http://127.0.0.1:${api_port}" --role=player-b \
run_godot --control-plane-url="http://${client_api_host}:${api_port}" --role=player-b \
>"$logs_dir/godot-player-b.log" 2>&1 &
player_b_pid=$!