976f5238f8
- internal .env loader (real env wins) + strictly validated config struct - ULID package: 48-bit ms timestamp + 80-bit crypto randomness, sortable - HTTP server with recovery/request-id/trusted-proxy/access-log middleware - /healthz, /readyz (pluggable checkers), /metricsz (counter registry) - multi-stage Dockerfile (alpine, non-root) + compose with healthchecks, app bound to 127.0.0.1:8787, mongo unpublished, graceful 15s shutdown Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
29 lines
1.1 KiB
Bash
Executable File
29 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Curl-based smoke test against a running stack (docker compose up -d).
|
|
# Grows with the system; later phases add register→login→board coverage.
|
|
set -euo pipefail
|
|
|
|
BASE_URL="${BASE_URL:-http://localhost:8787}"
|
|
fail() { echo "SMOKE FAIL: $*" >&2; exit 1; }
|
|
|
|
echo "smoke: $BASE_URL"
|
|
|
|
# healthz must always be 200 while the process is up
|
|
code=$(curl -fsS -o /tmp/smoke-healthz.json -w '%{http_code}' "$BASE_URL/healthz") \
|
|
|| fail "healthz unreachable"
|
|
[ "$code" = "200" ] || fail "healthz returned $code"
|
|
grep -q '"ok"' /tmp/smoke-healthz.json || fail "healthz body unexpected: $(cat /tmp/smoke-healthz.json)"
|
|
echo " healthz ok"
|
|
|
|
# readyz reflects dependency state; required deps must be up for the smoke run
|
|
code=$(curl -sS -o /tmp/smoke-readyz.json -w '%{http_code}' "$BASE_URL/readyz") \
|
|
|| fail "readyz unreachable"
|
|
[ "$code" = "200" ] || fail "readyz returned $code: $(cat /tmp/smoke-readyz.json)"
|
|
echo " readyz ok"
|
|
|
|
# metricsz exposes counters
|
|
curl -fsS "$BASE_URL/metricsz" | grep -q '"counters"' || fail "metricsz body unexpected"
|
|
echo " metricsz ok"
|
|
|
|
echo "SMOKE PASS"
|