mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
test(multiplayer): make local gate portable
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
|
||||
ROOT = Path(__file__).parents[1]
|
||||
|
||||
|
||||
class LocalMultiplayerGateTest(unittest.TestCase):
|
||||
def test_godot_gate_has_a_digest_pinned_container_fallback(self):
|
||||
script = (ROOT / "scripts" / "verify_multiplayer_local.sh").read_text()
|
||||
self.assertIn("run_godot_harness()", script)
|
||||
self.assertIn("barichello/godot-ci@sha256:", script)
|
||||
self.assertIn("docker run --rm --platform linux/amd64", script)
|
||||
self.assertIn("type=bind,src=$root_dir,dst=/workspace", script)
|
||||
self.assertIn("Godot executable not found", script)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -3,11 +3,23 @@ set -euo pipefail
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
godot_bin="${GODOT_BIN:-/Applications/Godot.app/Contents/MacOS/Godot}"
|
||||
godot_image="barichello/godot-ci@sha256:622e5ca81b54cd8038ecf7de5d157b47efc800d7cf635af2eec18a6aee4bab7e"
|
||||
|
||||
if [[ ! -x "$godot_bin" ]]; then
|
||||
echo "local multiplayer gate: Godot executable not found: $godot_bin" >&2
|
||||
exit 2
|
||||
fi
|
||||
run_godot_harness() {
|
||||
if [[ -x "$godot_bin" ]]; then
|
||||
"$godot_bin" --headless --path "$root_dir/Game" res://tests/test_runner.tscn
|
||||
return
|
||||
fi
|
||||
if ! command -v docker >/dev/null 2>&1 || ! docker info >/dev/null 2>&1; then
|
||||
echo "local multiplayer gate: Godot executable not found ($godot_bin), and Docker is unavailable for the pinned headless fallback" >&2
|
||||
return 2
|
||||
fi
|
||||
echo "local multiplayer gate: using pinned headless Godot container fallback"
|
||||
docker run --rm --platform linux/amd64 \
|
||||
--mount "type=bind,src=$root_dir,dst=/workspace" \
|
||||
-w /workspace "$godot_image" \
|
||||
godot --headless --path Game res://tests/test_runner.tscn
|
||||
}
|
||||
|
||||
echo "local multiplayer gate: Go tests"
|
||||
(cd "$root_dir/server" && go test ./...)
|
||||
@@ -22,7 +34,7 @@ echo "local multiplayer gate: bounded fuzz targets"
|
||||
(cd "$root_dir/server" && go test ./domain -fuzz FuzzSyncEventApplicationDoesNotPanic -fuzztime=2s)
|
||||
|
||||
echo "local multiplayer gate: Godot harness"
|
||||
"$godot_bin" --headless --path "$root_dir/Game" res://tests/test_runner.tscn
|
||||
run_godot_harness
|
||||
|
||||
echo "local multiplayer gate: contracts and manifests"
|
||||
python3 -m json.tool "$root_dir/server/contracts/v1/openapi.json" >/dev/null
|
||||
|
||||
Reference in New Issue
Block a user