d856a2eaa9
test_health.py:
- Keep existing test_health(client) sync test unchanged (Plan 01 baseline)
- Add test_health_checks_postgres_and_minio(async_client) xfail scaffold
for extended /health response with postgres+minio checks (Plan 05, D-07)
test_documents.py:
- Keep all 9 existing sync tests verbatim
- Add async ports (_async suffix) for each: 9 xfail tests using async_client
- Add test_upload_persists_to_postgres_and_minio_async (UUID id + GET
round-trip assertion) — xfail until Plan 05 storage rewrite
- Total: 10 new xfail async tests, 9 sync tests unchanged
30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
"""
|
|
Health endpoint tests.
|
|
|
|
test_health — existing sync test, validates current behavior (Plan 01 baseline).
|
|
test_health_checks_postgres_and_minio — xfail scaffold for Plan 05 extended health probe.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
|
|
def test_health(client):
|
|
resp = client.get("/health")
|
|
assert resp.status_code == 200
|
|
assert resp.json() == {"status": "ok"}
|
|
|
|
|
|
@pytest.mark.xfail(strict=False, reason="extended health probe implemented in plan 05")
|
|
async def test_health_checks_postgres_and_minio(async_client):
|
|
"""Plan 05 extends /health to include per-service connectivity checks (D-07, STORE-07)."""
|
|
resp = await async_client.get("/health")
|
|
assert resp.status_code == 200
|
|
data = resp.json()
|
|
assert "checks" in data, "Response missing 'checks' key"
|
|
assert "postgres" in data["checks"], "checks missing 'postgres'"
|
|
assert "minio" in data["checks"], "checks missing 'minio'"
|
|
assert data["checks"]["postgres"] == "ok", f"postgres check: {data['checks']['postgres']!r}"
|
|
assert data["checks"]["minio"] == "ok", f"minio check: {data['checks']['minio']!r}"
|
|
assert data["status"] == "ok", f"overall status: {data['status']!r}"
|