fix(deploy): test-api.sh — skip capture 404 (sidecar/idle mode is normal)
This commit is contained in:
parent
5161644205
commit
28a97e2ba3
1 changed files with 29 additions and 25 deletions
|
|
@ -88,43 +88,43 @@ fi
|
|||
|
||||
# ── Auth ─────────────────────────────────────────────────────────────────────
|
||||
header "Auth"
|
||||
check_status "GET /auth/me" "/api/v1/auth/me" 200
|
||||
check_body "GET /auth/me returns username" "/api/v1/auth/me" '"username"'
|
||||
check_post "POST /auth/login (missing body → 400)" "/api/v1/auth/login" '{}' 400
|
||||
check_status "GET /auth/me" "/api/v1/auth/me" 200
|
||||
check_body "GET /auth/me returns username" "/api/v1/auth/me" '"username"'
|
||||
check_post "POST /auth/login (missing body → 400)" "/api/v1/auth/login" '{}' 400
|
||||
|
||||
# ── Assets ───────────────────────────────────────────────────────────────────
|
||||
header "Assets"
|
||||
check_status "GET /assets" "/api/v1/assets" 200
|
||||
check_body "GET /assets returns assets key" "/api/v1/assets" '"assets"'
|
||||
check_status "GET /assets bogus id → 404" "/api/v1/assets/00000000-0000-0000-0000-000000000000" 404
|
||||
check_status "GET /assets" "/api/v1/assets" 200
|
||||
check_body "GET /assets returns assets key" "/api/v1/assets" '"assets"'
|
||||
check_status "GET /assets bogus id → 404" "/api/v1/assets/00000000-0000-0000-0000-000000000000" 404
|
||||
|
||||
# ── Projects ─────────────────────────────────────────────────────────────────
|
||||
header "Projects"
|
||||
check_status "GET /projects" "/api/v1/projects" 200
|
||||
check_body "GET /projects returns array" "/api/v1/projects" '['
|
||||
check_status "GET /projects" "/api/v1/projects" 200
|
||||
check_body "GET /projects returns array" "/api/v1/projects" '['
|
||||
|
||||
# ── Jobs ─────────────────────────────────────────────────────────────────────
|
||||
header "Jobs"
|
||||
check_status "GET /jobs" "/api/v1/jobs" 200
|
||||
check_body "GET /jobs returns array" "/api/v1/jobs" '['
|
||||
check_status "GET /jobs" "/api/v1/jobs" 200
|
||||
check_body "GET /jobs returns array" "/api/v1/jobs" '['
|
||||
|
||||
# ── Recorders ────────────────────────────────────────────────────────────────
|
||||
header "Recorders"
|
||||
check_status "GET /recorders" "/api/v1/recorders" 200
|
||||
check_status "GET /recorders" "/api/v1/recorders" 200
|
||||
|
||||
# ── Sequences (requires project_id param) ────────────────────────────────────
|
||||
header "Sequences"
|
||||
check_status "GET /sequences (no project_id → 400)" "/api/v1/sequences" 400
|
||||
check_status "GET /sequences bogus project_id → 200" "/api/v1/sequences?project_id=00000000-0000-0000-0000-000000000000" 200
|
||||
check_status "GET /sequences (no project_id → 400)" "/api/v1/sequences" 400
|
||||
check_status "GET /sequences bogus project_id → 200" "/api/v1/sequences?project_id=00000000-0000-0000-0000-000000000000" 200
|
||||
|
||||
# ── Settings ─────────────────────────────────────────────────────────────────
|
||||
header "Settings"
|
||||
check_status "GET /settings/ampp" "/api/v1/settings/ampp" 200
|
||||
check_status "GET /settings/ampp" "/api/v1/settings/ampp" 200
|
||||
|
||||
# ── Cluster ──────────────────────────────────────────────────────────────────
|
||||
header "Cluster"
|
||||
check_status "GET /cluster" "/api/v1/cluster" 200
|
||||
check_body "GET /cluster returns array" "/api/v1/cluster" '['
|
||||
check_status "GET /cluster" "/api/v1/cluster" 200
|
||||
check_body "GET /cluster returns array" "/api/v1/cluster" '['
|
||||
|
||||
# Heartbeat: register a temporary smoke-test node, verify it appears, remove it
|
||||
TEST_HOST="smoke-test-$(date +%s)"
|
||||
|
|
@ -132,7 +132,6 @@ check_post "POST /cluster/heartbeat" "/api/v1/cluster/heartbeat" \
|
|||
"{\"hostname\":\"$TEST_HOST\",\"role\":\"smoketest\",\"cpu_usage\":0,\"mem_used_mb\":512,\"mem_total_mb\":4096}" \
|
||||
200
|
||||
|
||||
# Find the node we just registered (grab first UUID from array)
|
||||
NODE_ID=$(curl -s "${AUTH_ARGS[@]}" "$BASE/api/v1/cluster" 2>/dev/null \
|
||||
| grep -o '"id":"[^"]*"' | head -1 | grep -o '[0-9a-f-]\{36\}' || true)
|
||||
|
||||
|
|
@ -148,25 +147,30 @@ fi
|
|||
|
||||
# ── System / Containers ───────────────────────────────────────────────────────
|
||||
header "System"
|
||||
check_status "GET /system/containers" "/api/v1/system/containers" 200
|
||||
check_body "Containers returns array" "/api/v1/system/containers" '['
|
||||
check_status "GET /system/containers" "/api/v1/system/containers" 200
|
||||
check_body "Containers returns array" "/api/v1/system/containers" '['
|
||||
|
||||
# ── Capture (proxies to capture service — 500 if container is down) ───────────
|
||||
# ── Capture (proxies to capture service) ─────────────────────────────────────
|
||||
header "Capture"
|
||||
# 200 = capture active and responding
|
||||
# 404 = capture in sidecar/idle mode (no active recorder — expected in dev)
|
||||
# 5xx = capture container unreachable
|
||||
CAPTURE_CODE=$(curl -s -o /dev/null -w "%{http_code}" "${AUTH_ARGS[@]}" \
|
||||
"$BASE/api/v1/capture/status" 2>/dev/null)
|
||||
if [[ "$CAPTURE_CODE" == "200" ]]; then
|
||||
pass "GET /capture/status [HTTP 200]"
|
||||
pass "GET /capture/status [HTTP 200 — capture active]"
|
||||
elif [[ "$CAPTURE_CODE" == "404" ]]; then
|
||||
skip "GET /capture/status [HTTP 404]" "capture in idle/sidecar mode (normal when not recording)"
|
||||
elif [[ "$CAPTURE_CODE" =~ ^5 ]]; then
|
||||
skip "GET /capture/status [HTTP $CAPTURE_CODE]" "capture service proxy error (container down?)"
|
||||
skip "GET /capture/status [HTTP $CAPTURE_CODE]" "capture container unreachable"
|
||||
else
|
||||
fail "GET /capture/status [HTTP $CAPTURE_CODE]" "expected 200 or 5xx"
|
||||
fail "GET /capture/status [HTTP $CAPTURE_CODE]" "unexpected status"
|
||||
fi
|
||||
|
||||
# ── Users / Tokens ───────────────────────────────────────────────────────────
|
||||
header "Users / Tokens"
|
||||
check_status "GET /users" "/api/v1/users" 200
|
||||
check_status "GET /tokens" "/api/v1/tokens" 200
|
||||
check_status "GET /users" "/api/v1/users" 200
|
||||
check_status "GET /tokens" "/api/v1/tokens" 200
|
||||
|
||||
# ── Summary ───────────────────────────────────────────────────────────────────
|
||||
TOTAL=$((PASS + FAIL + SKIP))
|
||||
|
|
|
|||
Loading…
Reference in a new issue