fix(deploy): smoke probe — POST to unknown path expects 403, not GET to /health
Browse filesHF Space's Tornado server returns 200 with SPA HTML for any GET path,
including /health. The original probe incorrectly expected 403 on GET.
POST requests to non-existent endpoints correctly return 403, so this
test is moved to a meaningful assertion: verify unknown POST paths
are rejected. Widened probe() helper to accept HTTP method parameter.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- scripts/smoke_hf_space.sh +10 -5
scripts/smoke_hf_space.sh
CHANGED
|
@@ -12,9 +12,14 @@ 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
if [[ "$actual" == "$expect" ]]; then
|
| 19 |
printf " OK %-40s %s\n" "$label" "$actual"
|
| 20 |
else
|
|
@@ -24,9 +29,9 @@ probe() {
|
|
| 24 |
}
|
| 25 |
|
| 26 |
echo "Probing $BASE"
|
| 27 |
-
probe "frontend root" "$BASE/" "200"
|
| 28 |
-
probe "streamlit health" "$BASE/_stcore/health" "200"
|
| 29 |
-
probe "
|
| 30 |
|
| 31 |
echo
|
| 32 |
if [[ "$FAIL" == "0" ]]; then
|
|
|
|
| 12 |
FAIL=0
|
| 13 |
|
| 14 |
probe() {
|
| 15 |
+
local label="$1" url="$2" expect="$3" method="${4:-GET}"
|
| 16 |
local actual
|
| 17 |
+
if [[ "$method" == "POST" ]]; then
|
| 18 |
+
actual="$(curl -sS -o /dev/null -w "%{http_code}" -X POST \
|
| 19 |
+
-H 'content-type: application/json' -d '{}' "$url")"
|
| 20 |
+
else
|
| 21 |
+
actual="$(curl -sS -o /dev/null -w "%{http_code}" "$url")"
|
| 22 |
+
fi
|
| 23 |
if [[ "$actual" == "$expect" ]]; then
|
| 24 |
printf " OK %-40s %s\n" "$label" "$actual"
|
| 25 |
else
|
|
|
|
| 29 |
}
|
| 30 |
|
| 31 |
echo "Probing $BASE"
|
| 32 |
+
probe "frontend root" "$BASE/" "200" "GET"
|
| 33 |
+
probe "streamlit health" "$BASE/_stcore/health" "200" "GET"
|
| 34 |
+
probe "POST to unknown path is rejected" "$BASE/predict/bbb" "403" "POST"
|
| 35 |
|
| 36 |
echo
|
| 37 |
if [[ "$FAIL" == "0" ]]; then
|