#!/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"