Sanad_Package_4/test_p4.sh

21 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Smoke-test Sanad Package 4. Usage: ./test_p4.sh [host:port] (default 127.0.0.1:8014)
H="${1:-127.0.0.1:8014}"; B="http://$H"; pass=0; fail=0
chk(){ local code; if [ "$1" = GET ]; then code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 8 "$B$2")
else code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 8 -X "$1" "$B$2"); fi
if [ "$code" = "$3" ]; then printf " PASS [%s] %-30s %s\n" "$code" "$1 $2" "$4"; pass=$((pass+1))
else printf " FAIL [%s≠%s] %-26s %s\n" "$code" "$3" "$1 $2" "$4"; fail=$((fail+1)); fi; }
echo "== Sanad P4 smoke test @ $B =="
chk GET /api/health 200 "health"
chk GET /api/package 200 "manifest + license + features"
chk GET /api/p4/settings 200 "settings"
chk GET /api/tour/ 200 "tour list"
chk GET /api/tour/status 200 "tour runtime status"
chk GET /api/nav/status 200 "nav status (via WebNav3Client)"
chk GET /api/zones/ 200 "places / zones"
chk GET /api/live-subprocess/status 200 "conversation status"
chk GET /api/system/info 200 "system info"
chk GET /api/logs/ 200 "logs"
echo "== $pass passed, $fail failed =="
curl -s --max-time 6 "$B/api/package" | python3 -c 'import sys,json;d=json.load(sys.stdin);print(" package:",d.get("package")," features:",d.get("features"))' 2>/dev/null||true