Health module has no tests: liveness and readiness probes are uncovered
Labels / Complexity: testing · Medium Complexity — Medium
Problem
src/health/ (2 files, 0 *.spec.ts) implements the Kubernetes probes — GET /healthz (liveness), GET /readyz (readiness: DB + Redis), GET /startupz (startup: DB + migration state). These endpoints decide whether K8s restarts or drains the pod, yet none of them are tested: a regression that makes /readyz always report ready (or always failing) ships silently and either masks outages or causes restart loops.
Why this is architecturally hard
- Probe semantics need dependency stubs. Testing
/readyz requires stubbing DB and Redis up/down states and asserting the correct status code and body for each combination.
- The endpoints are deployment-critical. The test design must cover the failure modes that matter in production: DB down, Redis down, both down.
Acceptance criteria
- Tests cover
/healthz, /readyz, and /startupz for healthy and degraded dependency states.
- Tests run in CI via
npm test.
- The PR reports the module's coverage change (
npm run test:cov).
Out of scope
Changing probe behavior or thresholds.
Getting started
src/health/health.controller.ts — the probe endpoints
src/cache/cache.service.ts — the Redis health dependency
Commands: npm test, npm run test:cov.
Good first files to read: src/health/health.controller.ts, test/e2e/analytics-date-range.spec.ts.
Health module has no tests: liveness and readiness probes are uncovered
Labels / Complexity: testing · Medium Complexity — Medium
Problem
src/health/(2 files, 0*.spec.ts) implements the Kubernetes probes —GET /healthz(liveness),GET /readyz(readiness: DB + Redis),GET /startupz(startup: DB + migration state). These endpoints decide whether K8s restarts or drains the pod, yet none of them are tested: a regression that makes/readyzalways report ready (or always failing) ships silently and either masks outages or causes restart loops.Why this is architecturally hard
/readyzrequires stubbing DB and Redis up/down states and asserting the correct status code and body for each combination.Acceptance criteria
/healthz,/readyz, and/startupzfor healthy and degraded dependency states.npm test.npm run test:cov).Out of scope
Changing probe behavior or thresholds.
Getting started
src/health/health.controller.ts— the probe endpointssrc/cache/cache.service.ts— the Redis health dependencyCommands:
npm test,npm run test:cov.Good first files to read:
src/health/health.controller.ts,test/e2e/analytics-date-range.spec.ts.