Skip to content

Add /health to end-to-end API checks #178

Description

@tonytrieu-dev

The /health readiness endpoint is now part of the API, but the end-to-end smoke tests do not currently exercise it. CI verifies the database CRUD flow against a real temporary database, but it does not verify that the service reports readiness after its actual FastAPI startup lifecycle.

This would be a useful, small follow-up to the health endpoint work: if startup wiring, cache initialization, or route registration changes later, the existing E2E checks should catch a broken readiness signal.

The repository is also migrating the test suite to pytest in #167 / PR #177. This issue should be implemented on top of that migration rather than introducing another test-framework change.

Proposed changes

  • Add a documented /health request to the pytest-based end-to-end API test suite.
  • Start the application through the existing TestClient lifecycle so the real startup handler runs.
  • Assert that a fresh isolated database returns HTTP 200 and {"status": "ok"} from /health.
  • Keep the focused health regression test for the defensive unavailable-cache 503 branch.
  • Update E2E/testing documentation only if the coverage description needs to mention the readiness check.

Why this is worth testing end to end

The focused health tests cover the route contract and the defensive unavailable-cache branch. An E2E assertion covers the operational path that deployment systems actually depend on: the application starts, loads the configured database file, registers the route, and reports ready.

Scope and non-duplication

This issue does not migrate tests to pytest, add a second health endpoint, or change the readiness contract. It adds one missing assertion to the real API smoke path after the repository's existing test-framework migration is complete.

Acceptance criteria

  • The pytest-based E2E suite calls GET /health through the real FastAPI startup lifecycle.
  • The test uses an isolated temporary database and does not modify the repository's .sdb file.
  • A ready service returns HTTP 200 with {"status": "ok"}.
  • Existing CRUD and error-path E2E coverage remains unchanged.
  • CI runs the new readiness assertion.
  • Testing documentation reflects the added E2E coverage where appropriate.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions