Skip to content

Feat/test readiness contract#200

Merged
AAdewunmi merged 2 commits into
mainfrom
feat/test-readiness-contract
Apr 21, 2026
Merged

Feat/test readiness contract#200
AAdewunmi merged 2 commits into
mainfrom
feat/test-readiness-contract

Conversation

@AAdewunmi

Copy link
Copy Markdown
Owner

Summary

Adds focused test coverage for the readiness contract exposed by /api/health/.

Changes

  • add integration coverage in tests/test_health_api.py for the public health endpoint
  • verify the healthy path returns 200 OK with the expected readiness payload fields
  • verify the degraded path returns 503 Service Unavailable with a stable payload shape
  • align the tests with the actual project routing and view import paths

Behavior

  • GET /api/health/ is exercised through the real URL configuration
  • healthy checks return 200 with status=ok and checks.database=ok
  • degraded checks return 503 with status=degraded and checks.database=unavailable
  • the response contract remains stable for monitoring and deployment tooling

Why

  • protects the readiness endpoint from regressions in route wiring and response shape
  • ensures both operational states are covered explicitly
  • improves confidence in the deployment-facing contract reported by the health probe

Validation

  • docker compose exec web pytest tests/test_health_api.py -q

Result

  • focused readiness endpoint integration tests passed: 2 passed

Notes

  • the tests were updated to use the repo’s real route namespace, core_api:health
  • the degraded-path test patches core.api.views.get_readiness_payload, which matches the actual view implementation

@codecov

codecov Bot commented Apr 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AAdewunmi AAdewunmi merged commit d2c1789 into main Apr 21, 2026
2 checks passed
@AAdewunmi AAdewunmi deleted the feat/test-readiness-contract branch April 21, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sprint-7-tests-backend Test readiness contract

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

1 participant