test(deploy): scripts/smoke_hf_space.sh — sealed HTTP envelope probe
Browse files- scripts/smoke_hf_space.sh +40 -0
scripts/smoke_hf_space.sh
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Sealed smoke probe for the live HF Space.
|
| 3 |
+
# Verifies what we can verify without a browser: HTTP envelope, Streamlit
|
| 4 |
+
# health, response headers. Returns 0 on success, 1 on any failure.
|
| 5 |
+
#
|
| 6 |
+
# Usage: scripts/smoke_hf_space.sh [base_url]
|
| 7 |
+
# default base_url: https://mekosotto-hackathon.hf.space
|
| 8 |
+
|
| 9 |
+
set -euo pipefail
|
| 10 |
+
|
| 11 |
+
BASE="${1:-https://mekosotto-hackathon.hf.space}"
|
| 12 |
+
FAIL=0
|
| 13 |
+
|
| 14 |
+
probe() {
|
| 15 |
+
local label="$1" url="$2" expect="$3"
|
| 16 |
+
local actual
|
| 17 |
+
actual="$(curl -sS -o /dev/null -w "%{http_code}" "$url")"
|
| 18 |
+
if [[ "$actual" == "$expect" ]]; then
|
| 19 |
+
printf " OK %-40s %s\n" "$label" "$actual"
|
| 20 |
+
else
|
| 21 |
+
printf " FAIL %-40s expected=%s actual=%s\n" "$label" "$expect" "$actual"
|
| 22 |
+
FAIL=1
|
| 23 |
+
fi
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
echo "Probing $BASE"
|
| 27 |
+
probe "frontend root" "$BASE/" "200"
|
| 28 |
+
probe "streamlit health" "$BASE/_stcore/health" "200"
|
| 29 |
+
probe "fastapi NOT publicly mounted (good)" "$BASE/health" "403"
|
| 30 |
+
|
| 31 |
+
echo
|
| 32 |
+
if [[ "$FAIL" == "0" ]]; then
|
| 33 |
+
echo "Smoke OK — proceed to manual click-through checklist:"
|
| 34 |
+
echo " docs/superpowers/notes/2026-04-30-hf-smoke-checklist.md"
|
| 35 |
+
exit 0
|
| 36 |
+
else
|
| 37 |
+
echo "Smoke FAILED — see HF Space logs at:"
|
| 38 |
+
echo " https://huggingface.co/spaces/mekosotto/hackathon/discussions"
|
| 39 |
+
exit 1
|
| 40 |
+
fi
|