42 lines
2.4 KiB
Bash
42 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
|
# Smoke-test Sanad Package 2. Usage: ./test_p2.sh [host:port] (default 127.0.0.1:8012)
|
|
# Read-only (no key delete / no log delete / no speak / no arm trigger).
|
|
H="${1:-127.0.0.1:8012}"; B="http://$H"; pass=0; fail=0
|
|
chk(){ # chk METHOD PATH EXPECT desc
|
|
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] %-34s %s\n" "$code" "$1 $2" "$4"; pass=$((pass+1))
|
|
else printf " FAIL [%s≠%s] %-30s %s\n" "$code" "$3" "$1 $2" "$4"; fail=$((fail+1)); fi
|
|
}
|
|
echo "== Sanad P2 smoke test @ $B =="
|
|
chk GET /api/health 200 "health"
|
|
chk GET /api/package 200 "manifest + license + features + key"
|
|
chk GET /api/p2/api-key 200 "key status (masked)"
|
|
chk GET /api/p2/persona 200 "persona"
|
|
chk GET /api/p2/settings 200 "combined settings (+ mask)"
|
|
chk GET /api/audio/profiles 200 "audio profiles"
|
|
chk GET /api/audio/g1-speaker/volume 200 "chest volume"
|
|
chk GET /api/live-subprocess/status 200 "conversation status"
|
|
chk GET /api/live-voice/status 200 "voice-command gestures status"
|
|
chk GET /api/wake-phrases/ 200 "wake phrases"
|
|
chk GET /api/skills/ 200 "skills registry"
|
|
chk GET /api/motion/actions 200 "arm actions list"
|
|
chk GET /api/mask/status 200 "LED mask status"
|
|
chk GET /api/system/info 200 "system info"
|
|
chk GET /api/logs/ 200 "logs list"
|
|
chk POST /api/audio/refresh 200 "rescan devices"
|
|
echo "== $pass passed, $fail failed =="
|
|
echo "-- manifest --"
|
|
curl -s --max-time 6 "$B/api/package" | python3 -c '
|
|
import sys, json
|
|
d = json.load(sys.stdin)
|
|
lic = d.get("license") or {}
|
|
print(" package :", d.get("package"))
|
|
print(" license :", lic.get("valid"), " packages:", lic.get("packages"))
|
|
print(" features:", d.get("features"))
|
|
print(" key :", "set" if (d.get("api_key") or {}).get("has_key") else "NONE (customer adds own)")
|
|
print(" language:", d.get("language"), " audio:", d.get("audio_profile"))
|
|
' 2>/dev/null || true
|
|
echo "-- mask --"; curl -s --max-time 6 "$B/api/mask/status" | python3 -c "import sys,json;d=json.load(sys.stdin);print(' connected:',d.get('connected',d.get('is_connected')),' lib:',d.get('lib_available'))" 2>/dev/null || echo " (mask status unavailable)"
|