fix(tests): align docker-e2e health asserts with current /api/health shape

`/api/health` is the auth-free LB probe — returns `status` + `db_schema`
only. `version` lives in `/api/version` and the richer
`services.duckdb_state` lives in `/api/health/detailed` (auth-gated).
The two e2e asserts had drifted and broke nightly on main.
This commit is contained in:
ZdenekSrotyr 2026-05-03 11:21:19 +02:00
parent 916d0cb4c6
commit f348296685
3 changed files with 19 additions and 6 deletions

View file

@ -59,6 +59,13 @@ CalVer image tags (`stable-YYYY.MM.N`, `dev-YYYY.MM.N`) are produced for every C
concrete next step. Falls back to DuckDB's raw error for non-materialized concrete next step. Falls back to DuckDB's raw error for non-materialized
unknowns. unknowns.
### Internal
- **tests**: refresh `docker-e2e` health asserts to match the current
`/api/health` shape (auth-free, returns `status` + `db_schema` only).
`version` moved to `/api/version` in 0.10-era refactor; richer
`services.duckdb_state` lives in `/api/health/detailed` (auth-gated).
Tests had drifted and broke nightly e2e on main.
## [0.30.0] — 2026-05-01 ## [0.30.0] — 2026-05-01
### Added ### Added

View file

@ -40,12 +40,17 @@ def require_docker():
def test_app_health(): def test_app_health():
"""Health endpoint returns 200 with status and version fields.""" """/api/health is the auth-free LB probe — status + db_schema only.
Version metadata moved to /api/version (see app/api/health.py)."""
resp = httpx.get(f"{DOCKER_BASE_URL}/api/health", timeout=10) resp = httpx.get(f"{DOCKER_BASE_URL}/api/health", timeout=10)
assert resp.status_code == 200 assert resp.status_code == 200
data = resp.json() data = resp.json()
assert "status" in data assert data.get("status") == "ok"
assert "version" in data assert data.get("db_schema") == "ok"
ver = httpx.get(f"{DOCKER_BASE_URL}/api/version", timeout=10)
assert ver.status_code == 200
assert "version" in ver.json()
def test_app_returns_html_on_root(): def test_app_returns_html_on_root():

View file

@ -75,12 +75,13 @@ class TestDockerHealth:
assert data.get("status") in ("ok", "healthy") assert data.get("status") in ("ok", "healthy")
def test_health_has_duckdb(self, docker_env): def test_health_has_duckdb(self, docker_env):
# /api/health touches system.duckdb to read schema_version, so
# db_schema='ok' implies DuckDB is reachable. The richer
# services.duckdb_state lives in /api/health/detailed (auth-gated).
import httpx import httpx
resp = httpx.get(f"{docker_env}/api/health") resp = httpx.get(f"{docker_env}/api/health")
data = resp.json() data = resp.json()
services = data.get("services", {}) assert data.get("db_schema") == "ok"
assert "duckdb_state" in services
assert services["duckdb_state"]["status"] == "ok"
class TestDockerFullFlow: class TestDockerFullFlow: