Skip to content

Latest commit

 

History

History
62 lines (47 loc) · 4.25 KB

File metadata and controls

62 lines (47 loc) · 4.25 KB

Test Coverage Matrix — Health Endpoint

Scoped to the Health endpoint feature area only. Other areas covered by sibling test-builder runs.


1. Interactive elements

ID Element Where (mockup / file) Test ID(s)
IE-001 GET /health route mockup-f-health-check.png · app/routers/health.py HEALTH-UNIT-001, HEALTH-UNIT-002, HEALTH-INT-001, HEALTH-E2E-001
IE-002 POST /health (disallowed method) spec §4 API Reference · app/routers/health.py HEALTH-UNIT-003
IE-003 PUT /health (disallowed method) spec §4 API Reference · app/routers/health.py HEALTH-UNIT-004
IE-004 DELETE /health (disallowed method) spec §4 API Reference · app/routers/health.py HEALTH-UNIT-005
IE-005 Docker HEALTHCHECK instruction mockup-f-health-check.png · Dockerfile HEALTH-INT-002, HEALTH-E2E-002
IE-006 Query parameters on /health (e.g. ?foo=bar) Edge case — extra input to a no-param endpoint HEALTH-EDGE-001
IE-007 Request body on GET /health Edge case — body sent to a GET endpoint HEALTH-EDGE-002

2. State transitions

ID From → To Trigger Test ID(s)
ST-001 Service starting up → Healthy Uvicorn serves app; Docker HEALTHCHECK hits /health → 200 HEALTH-INT-002, HEALTH-E2E-002
ST-002 Healthy → Healthy (steady state) Repeated /health calls all return 200 HEALTH-EDGE-003
ST-003 Healthy → Method Not Allowed Non-GET verb sent to /health → 405 HEALTH-UNIT-003, HEALTH-UNIT-004, HEALTH-UNIT-005
ST-004 N/A → Response body verified GET /health → response JSON body is exactly {"status": "ok"} HEALTH-UNIT-001
ST-005 N/A → Response content-type verified GET /health → Content-Type is application/json HEALTH-UNIT-002

3. Error & edge cases

ID Case Trigger Recovery Test ID(s)
EC-001 POST to /health POST /health N/A — 405 is the correct response, no recovery needed HEALTH-UNIT-003
EC-002 PUT to /health PUT /health N/A — 405 is the correct response HEALTH-UNIT-004
EC-003 DELETE to /health DELETE /health N/A — 405 is the correct response HEALTH-UNIT-005
EC-004 Query string on /health GET /health?foo=bar Should still return 200 — query params are ignored HEALTH-EDGE-001
EC-005 Request body on GET /health GET /health with JSON body Should still return 200 — body ignored on GET HEALTH-EDGE-002
EC-006 Rapid sequential requests 100 rapid GET /health calls All return 200 — stateless endpoint HEALTH-EDGE-003
EC-007 Wrong URL path GET /healthz (common alt-spelling) 404 — FastAPI default HEALTH-EDGE-004
EC-008 Trailing slash GET /health/ FastAPI default behaviour (redirect or 404) HEALTH-EDGE-005

4. Mockup states reachable by user action

Mockup State Reachable via Test ID(s)
F Docker HEALTHCHECK → FastAPI routes → 200 OK → Container healthy Send GET /health and verify 200 + {"status": "ok"} HEALTH-E2E-001, HEALTH-UX-F-001, HEALTH-UX-F-002, HEALTH-UX-F-003

5. Cross-state recovery flows

ID Scenario Test ID(s)
CSR-001 Method Not Allowed (405) → client retries with GET → 200 HEALTH-INT-001
CSR-002 Repeated health checks (steady-state) always return 200 HEALTH-EDGE-003

Coverage notes

  • The Health endpoint is intentionally simple (stateless, no parameters, no persistence). The main risk surface is: (1) correct HTTP method handling, (2) correct response shape, (3) Docker HEALTHCHECK integration, and (4) edge-case inputs that might confuse a load balancer.
  • No error-recovery cycle exists for this endpoint — the only "error" is using the wrong HTTP method, which correctly returns 405.
  • Mockup F shows a 4-step flow: Docker HEALTHCHECK → FastAPI routes → 200 OK → Container healthy. E2E and UX tests must exercise this full chain.
  • The implementation-plan Risk Flag about Docker HEALTHCHECK using curl vs pure-Python is directly testable: HEALTH-INT-002 validates the HEALTHCHECK instruction in the Dockerfile.