from pathlib import Path import unittest ROOT = Path(__file__).parents[2] class ComposeManifestTest(unittest.TestCase): def test_allocated_fixture_is_independent_of_legacy_smoke(self): allocated = (ROOT / "compose.allocated-smoke.yml").read_text() legacy = (ROOT / "compose.phase6-smoke.yml").read_text() self.assertIn("target: testkit-api", allocated) self.assertIn("target: game-server", allocated) self.assertIn("--drain-url=http://127.0.0.1:7780/drain", allocated) self.assertIn("--allocated-mode", allocated) self.assertIn('"18080:8080"', allocated) self.assertNotIn("compose.phase6-smoke.yml", allocated) self.assertNotIn("18080:8080", legacy) self.assertNotIn("max-matches", allocated) def test_allocated_runner_checks_durable_retry_and_shutdown(self): runner = (ROOT / "scripts/verify_allocated_compose.sh").read_text() allocated = (ROOT / "compose.allocated-smoke.yml").read_text() for marker in ( "/v1/servers/compose-server/result", "compose-result-key-123456", "result_receipts", "/v1/servers/compose-server/shutdown", "SERVER_SHUTDOWN", "/v1/session/steam", "compose-queue-key-123456", "/v1/queue/compose-queue-ticket/heartbeat", "/v1/proposals/$proposal_id/accept", "compose-match-ticket-", "down --volumes --remove-orphans", ): self.assertIn(marker, runner) self.assertIn("target: matcher", allocated) self.assertIn("target: allocator", allocated) self.assertIn("agones-provider", allocated) def test_chaos_fixture_has_real_maintenance_and_restart_boundary(self): chaos = (ROOT / "compose.chaos-smoke.yml").read_text() runner = (ROOT / "scripts/verify_chaos_recovery.sh").read_text() self.assertIn("target: maintenance", chaos) self.assertIn("restart control-plane", runner) self.assertIn("stalled-allocation:", runner) self.assertIn("down --volumes --remove-orphans", runner) def test_kind_runner_uses_strict_allocation_response_validation(self): runner = (ROOT / "scripts/verify_kind_agones.sh").read_text() self.assertIn("verify_agones_allocation_response.py", runner) self.assertNotIn("p.get(\"port\", 0) > 0", runner) if __name__ == "__main__": unittest.main()