Fix smoke test redirects and default updates to stable
This commit is contained in:
@@ -126,28 +126,45 @@ check_https() {
|
||||
check_api() {
|
||||
local url="$1"
|
||||
local body
|
||||
if ! body="$(curl -fsS --max-time 5 "$url")"; then
|
||||
if ! body="$(curl -kfsSL --max-time 5 "$url")"; then
|
||||
status FAIL "API not reachable: $url"
|
||||
return
|
||||
fi
|
||||
local ok
|
||||
ok="$(printf "%s" "$body" | json_get "services" || true)"
|
||||
if [ -n "$ok" ]; then
|
||||
status OK "API responds with JSON"
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
if printf "%s" "$body" | python3 - <<'PY'
|
||||
import json, sys
|
||||
try:
|
||||
data = json.load(sys.stdin)
|
||||
except Exception:
|
||||
sys.exit(1)
|
||||
for key in ("services", "hostname", "uptime_seconds"):
|
||||
if key in data:
|
||||
sys.exit(0)
|
||||
sys.exit(1)
|
||||
PY
|
||||
then
|
||||
status OK "API responds with JSON"
|
||||
else
|
||||
status WARN "API response did not include expected fields"
|
||||
fi
|
||||
else
|
||||
status WARN "API response did not include expected fields"
|
||||
status WARN "python3 missing; API JSON check skipped"
|
||||
fi
|
||||
}
|
||||
|
||||
check_firstboot() {
|
||||
local url="$1"
|
||||
local body state error_present
|
||||
if ! body="$(curl -fsS --max-time 5 "$url")"; then
|
||||
if ! body="$(curl -kfsSL --max-time 5 "$url")"; then
|
||||
status FAIL "firstboot API not reachable"
|
||||
return
|
||||
fi
|
||||
state="$(printf "%s" "$body" | json_get "state" || true)"
|
||||
error_present="$(printf "%s" "$body" | json_get "error_present" || true)"
|
||||
if [ -z "$state" ]; then
|
||||
status FAIL "firstboot status invalid or missing"
|
||||
return
|
||||
fi
|
||||
if [ "$state" = "done" ] && [ "$error_present" != "true" ]; then
|
||||
status OK "firstboot completed"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user