feat(soak): artifacts, graceful shutdown, health probes, smoke script, v3.3.4
Batched remaining harness tasks (27-30, 33):
Task 27 — Artifact capture on failure: screenshots, HTML snapshots,
game state JSON, and console error tails are captured into
tests/soak/artifacts/<run-id>/ when a scenario throws. Successful
runs get a summary.json. Old runs (>7d) are pruned on startup.
Task 28 — Graceful shutdown: first SIGINT/SIGTERM flips the abort
signal (scenarios finish current turn then unwind). 10s after, a
hard-kill fires if cleanup hangs. Double Ctrl-C = immediate exit.
Exit codes: 0 success, 1 errors, 2 interrupted.
Task 29 — Periodic health probes: every 30s GET /health against the
target server. Three consecutive failures abort the run with
health_fatal, preventing staging outages from being misattributed
to harness bugs. Corrected endpoint from /api/health to /health
per server/routers/health.py.
Task 30 — Smoke test script: tests/soak/scripts/smoke.sh, a 60s
end-to-end canary that health-probes the target, seeds if needed,
and runs one minimal populate game.
Task 33 — Version bump to v3.3.4: both index.html footers (was
v3.1.6), new footer added to admin.html (had none), pyproject.toml.
Also fixes discovered during stress testing:
- SessionPool sets baseURL on all contexts so relative goto('/')
resolves correctly between games (was "invalid URL" error)
- RoomCoordinator key is now unique per game-start (Date.now
suffix) so Deferred promises don't carry stale room codes from
previous games
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
37
tests/soak/scripts/smoke.sh
Executable file
37
tests/soak/scripts/smoke.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
# Soak harness smoke test — end-to-end canary against local dev.
|
||||
# Expected runtime: ~60 seconds.
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
: "${TEST_URL:=http://localhost:8000}"
|
||||
: "${SOAK_INVITE_CODE:=SOAKTEST}"
|
||||
|
||||
echo "Smoke target: $TEST_URL"
|
||||
echo "Invite code: $SOAK_INVITE_CODE"
|
||||
|
||||
# 1. Health probe
|
||||
curl -fsS "$TEST_URL/api/health" > /dev/null || {
|
||||
echo "FAIL: target server unreachable at $TEST_URL"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 2. Ensure minimum accounts
|
||||
if [ ! -f .env.stresstest ]; then
|
||||
echo "Seeding accounts..."
|
||||
bun run seed -- --count=4
|
||||
fi
|
||||
|
||||
# 3. Run minimum viable scenario
|
||||
TEST_URL="$TEST_URL" SOAK_INVITE_CODE="$SOAK_INVITE_CODE" \
|
||||
bun run soak -- \
|
||||
--scenario=populate \
|
||||
--accounts=2 \
|
||||
--rooms=1 \
|
||||
--cpus-per-room=0 \
|
||||
--games-per-room=1 \
|
||||
--holes=1 \
|
||||
--watch=none
|
||||
|
||||
echo "Smoke PASSED"
|
||||
Reference in New Issue
Block a user