mirror of
https://github.com/apidoorman/doorman.git
synced 2026-02-11 20:18:35 -06:00
26 lines
1.0 KiB
Bash
26 lines
1.0 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
BASE_URL="${BASE_URL:-http://localhost:5001}"
|
|
EMAIL="${STARTUP_ADMIN_EMAIL:-admin@localhost}"
|
|
PASSWORD="${STARTUP_ADMIN_PASSWORD:-password1}"
|
|
|
|
echo "[1/4] Checking liveness..."
|
|
curl -sfS "$BASE_URL/platform/monitor/liveness" | grep -q '"alive"' && echo "OK" || { echo "Liveness failed"; exit 1; }
|
|
|
|
echo "[2/4] Checking readiness..."
|
|
curl -sfS "$BASE_URL/platform/monitor/readiness" | grep -q '"ready"' && echo "OK" || { echo "Readiness degraded"; exit 1; }
|
|
|
|
echo "[3/4] Logging in..."
|
|
COOKIE_JAR="$(mktemp)"
|
|
trap 'rm -f "$COOKIE_JAR"' EXIT
|
|
curl -sfS -c "$COOKIE_JAR" -H 'Content-Type: application/json' \
|
|
-d "{\"email\":\"$EMAIL\",\"password\":\"$PASSWORD\"}" \
|
|
"$BASE_URL/platform/authorization" > /dev/null && echo "OK" || { echo "Login failed"; exit 1; }
|
|
|
|
echo "[4/4] Verifying token status..."
|
|
curl -sfS -b "$COOKIE_JAR" "$BASE_URL/platform/authorization/status" | grep -q '"Token is valid"' && echo "OK" || { echo "Token status check failed"; exit 1; }
|
|
|
|
echo "Smoke checks passed."
|
|
|