feat(auth): admin reset, docs and image smoke test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
42892cb37f
commit
06b9980659
18 files changed
+267
-21
No files matched your search
+23
-2
@@ -21,8 +21,20 @@ done
|
||||
# the writer gets SIGPIPE and `pipefail` turns that into a flaky failure.
|
||||
out=$(docker exec "$name" curl -fsS http://127.0.0.1:8787/api/health) || fail "/api/health did not answer"
|
||||
grep -q '"status":"ok"' <<<"$out" || fail "/api/health is not ok"
|
||||
out=$(docker exec "$name" curl -fsS http://127.0.0.1:8787/) || fail "dashboard did not answer"
|
||||
grep -qi '<!doctype html' <<<"$out" || fail "dashboard is not served"
|
||||
# The health endpoint is public and must not reveal the version.
|
||||
if grep -q '"version"' <<<"$out"; then fail "/api/health exposes the version"; fi
|
||||
# Without a login the dashboard and the API must refuse (401) or redirect.
|
||||
for path in / /api/alerts; do
|
||||
code=$(docker exec "$name" curl -sS -o /dev/null -w '%{http_code}' "http://127.0.0.1:8787$path") || fail "$path did not answer"
|
||||
case "$code" in
|
||||
401 | 301 | 302 | 303 | 307 | 308) ;;
|
||||
*) fail "$path answered $code without a login (expected 401 or a redirect)" ;;
|
||||
esac
|
||||
done
|
||||
out=$(docker exec "$name" curl -fsS http://127.0.0.1:8787/login.html) || fail "login page did not answer"
|
||||
grep -qi '<!doctype html' <<<"$out" || fail "login page is not served"
|
||||
logs=$(docker logs "$name" 2>&1)
|
||||
grep -q 'código de configuração' <<<"$logs" || fail "container log has no setup code"
|
||||
out=$(docker exec "$name" acaua doctor --json) || { echo "$out" >&2; fail "acaua doctor --json failed"; }
|
||||
duckdb=$(grep -A1 '"name": "duckdb"' <<<"$out") || true
|
||||
grep -q '"ok": true' <<<"$duckdb" || { echo "$out" >&2; fail "libduckdb is not usable"; }
|
||||
@@ -31,4 +43,13 @@ grep -q '"ok": true' <<<"$duckdb" || { echo "$out" >&2; fail "libduckdb is not u
|
||||
docker stop -t 10 "$name" >/dev/null
|
||||
code=$(docker inspect -f '{{.State.ExitCode}}' "$name")
|
||||
[ "$code" = 0 ] || fail "exit code $code after SIGTERM (expected 0: SIGTERM must stop serve)"
|
||||
# Mode `local` must refuse a port published beyond loopback.
|
||||
bad="$name-bad"
|
||||
trap 'docker rm -f "$name" "$bad" >/dev/null 2>&1 || true' EXIT
|
||||
docker run -d --name "$bad" -e ACAUA_PUBLISHED=0.0.0.0:8787 "$image" >/dev/null
|
||||
docker wait "$bad" >/dev/null
|
||||
code=$(docker inspect -f '{{.State.ExitCode}}' "$bad")
|
||||
[ "$code" != 0 ] || fail "local mode accepted ACAUA_PUBLISHED=0.0.0.0:8787"
|
||||
logs=$(docker logs "$bad" 2>&1)
|
||||
grep -q 'ACAUA_PUBLISHED' <<<"$logs" || { echo "$logs" >&2; fail "local mode refused for the wrong reason"; }
|
||||
echo "smoke: $image ok"
|
||||
Reference in new issue
Block a user