-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Add unit coverage for /healthz responses
Context
While wiring the health endpoint into a load balancer, I realized we have no tests covering the /healthz JSON/status behavior. A regression here could cause false positives or hide real outages.
Problem
The health handler assembles status and component fields (db/rpc), but success and failure paths aren’t tested. We could accidentally change the shape or status codes without noticing.
Expected behavior
/healthz should return 200 with "ok" statuses when both checks pass. If either check fails, it should return 503 and mark the failing component as "fail" while keeping the JSON shape stable.
Scope / non-goals
Don’t change handler logic beyond test coverage; keep the response fields stable.
Acceptance criteria
- Test covers the success path (200, statuses "ok").
- Test covers failure path for db or rpc (503, failing component marked "fail").
- JSON response includes
status,db, andrpckeys when provided.
Hints
Use httptest in internal/health to stub checkers. Run go test ./internal/health.
Reactions are currently unavailable