Merge pull request #166 from keboola/zs/fix-health-e2e-tests
fix(tests): align docker-e2e health asserts with current /api/health shape
This commit is contained in:
commit
214793b635
3 changed files with 22 additions and 7 deletions
|
|
@ -99,6 +99,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
|
||||||
|
|
|
||||||
|
|
@ -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():
|
||||||
|
|
|
||||||
|
|
@ -68,19 +68,22 @@ def docker_env():
|
||||||
|
|
||||||
class TestDockerHealth:
|
class TestDockerHealth:
|
||||||
def test_health_endpoint(self, docker_env):
|
def test_health_endpoint(self, docker_env):
|
||||||
|
# /api/health returns 'ok' or 'unhealthy' (never 'healthy' — that's
|
||||||
|
# the detailed endpoint's vocabulary). See app/api/health.py:111-118.
|
||||||
import httpx
|
import httpx
|
||||||
resp = httpx.get(f"{docker_env}/api/health")
|
resp = httpx.get(f"{docker_env}/api/health")
|
||||||
assert resp.status_code == 200
|
assert resp.status_code == 200
|
||||||
data = resp.json()
|
data = resp.json()
|
||||||
assert data.get("status") in ("ok", "healthy")
|
assert data.get("status") == "ok"
|
||||||
|
|
||||||
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:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue