#!/usr/bin/env bash # scripts/smoke-test.sh — test post-deploy minimal set -euo pipefail ENV_URL="${1:-${SMOKE_URL:-http://localhost:3000}}" TIMEOUT=10 echo "Smoke test against $ENV_URL" # 1. Healthcheck echo " [1/3] HEAD $ENV_URL" curl -sfI --max-time $TIMEOUT "$ENV_URL" > /dev/null # 2. Resolve auth.info (assumes Outline-style API) if [ -n "${SMOKE_AUTH_TOKEN:-}" ]; then echo " [2/3] auth.info" curl -sf -X POST --max-time $TIMEOUT \ -H "Authorization: Bearer $SMOKE_AUTH_TOKEN" \ -H "Content-Type: application/json" \ -d '{}' "$ENV_URL/api/auth.info" > /dev/null else echo " [2/3] auth.info — SKIP (SMOKE_AUTH_TOKEN absent)" fi # 3. Search if [ -n "${SMOKE_AUTH_TOKEN:-}" ]; then echo " [3/3] documents.search" curl -sf -X POST --max-time $TIMEOUT \ -H "Authorization: Bearer $SMOKE_AUTH_TOKEN" \ -H "Content-Type: application/json" \ -d '{"query":"smoke"}' "$ENV_URL/api/documents.search" > /dev/null fi echo "Smoke test OK"