35 lines
2.0 KiB
Bash
35 lines
2.0 KiB
Bash
#!/usr/bin/env bash
|
|
# Smoke-test Sanad Package 1. Usage: ./test_p1.sh [host:port] (default 127.0.0.1:8011)
|
|
# Read-only by default (no key delete / no log delete / no speak).
|
|
H="${1:-127.0.0.1:8011}"; 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 P1 smoke test @ $B =="
|
|
chk GET /api/health 200 "health"
|
|
chk GET /api/package 200 "manifest + license + key status"
|
|
chk GET /api/p1/api-key 200 "key status (masked)"
|
|
chk GET /api/p1/persona 200 "persona"
|
|
chk GET /api/p1/settings 200 "combined settings"
|
|
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/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)
|
|
print(" package :", d.get("package"))
|
|
print(" license :", (d.get("license") or {}).get("valid"), " packages:", (d.get("license") or {}).get("packages"))
|
|
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 " profiles:"; curl -s --max-time 6 "$B/api/audio/profiles" | python3 -c "import sys,json;print(' ',[p.get('id') for p in json.load(sys.stdin).get('profiles',[])])" 2>/dev/null || true
|