Files
aza/AzA march 2026 - Kopie (15)/deploy/smoke_test.sh
2026-04-19 20:41:37 +02:00

29 lines
733 B
Bash

#!/usr/bin/env bash
set -euo pipefail
BASE_URL="${1:-http://127.0.0.1}"
TOKEN="${MEDWORK_API_TOKEN:-}"
echo "[SMOKE] Base URL: ${BASE_URL}"
echo "[SMOKE] Checking /health ..."
curl -sS "${BASE_URL}/health" | cat
echo
echo
echo "[SMOKE] Checking /license/status without token (expect 401) ..."
code=$(curl -sS -o /dev/null -w "%{http_code}" "${BASE_URL}/license/status" || true)
echo "HTTP ${code}"
echo
if [[ -n "${TOKEN}" ]]; then
echo "[SMOKE] Checking /license/status with token ..."
curl -sS -H "X-API-Token: ${TOKEN}" -H "X-Device-Id: smoke-device" "${BASE_URL}/license/status" | cat
echo
echo
else
echo "[SMOKE] MEDWORK_API_TOKEN not set in environment; skipping authorized call."
echo
fi
echo "[SMOKE] Done."