Wire RUNNER_AUTH_TOKEN through dev/test/main Compose, validate uploads with extension whitelist and content sniffing, add readiness soak script and short PG loop test, and require runner token in prod when URL is set. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
732 B
Bash
Executable File
30 lines
732 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# test-soak.sh — test 环境 readiness 稳定性探测(Phase 5 soak 起步)
|
|
set -euo pipefail
|
|
|
|
BASE_URL="${1:-http://127.0.0.1:8081}"
|
|
DURATION_SEC="${2:-300}"
|
|
INTERVAL_SEC="${3:-10}"
|
|
|
|
end=$((SECONDS + DURATION_SEC))
|
|
ok=0
|
|
fail=0
|
|
|
|
echo "[soak] base=${BASE_URL} duration=${DURATION_SEC}s interval=${INTERVAL_SEC}s"
|
|
|
|
while (( SECONDS < end )); do
|
|
if curl -fsS "${BASE_URL}/api/v1/ready" >/dev/null 2>&1; then
|
|
ok=$((ok + 1))
|
|
echo "[soak] $(date -Is) ready OK (ok=${ok} fail=${fail})"
|
|
else
|
|
fail=$((fail + 1))
|
|
echo "[soak] $(date -Is) ready FAIL (ok=${ok} fail=${fail})" >&2
|
|
fi
|
|
sleep "${INTERVAL_SEC}"
|
|
done
|
|
|
|
echo "[soak] finished ok=${ok} fail=${fail}"
|
|
if (( fail > 0 )); then
|
|
exit 1
|
|
fi
|