41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
"""Tests for the readiness / integrity self-check (src/readiness.py)."""
|
|
|
|
from src.readiness import check_readiness
|
|
|
|
|
|
def test_readiness_reports_core_subsystems():
|
|
result = check_readiness()
|
|
|
|
assert {
|
|
"ready",
|
|
"version",
|
|
"upstream_version",
|
|
"app_version",
|
|
"build_flavor",
|
|
"build_version",
|
|
"checks",
|
|
"timestamp",
|
|
}.issubset(result.keys())
|
|
assert result["upstream_version"] == "1.0.1"
|
|
assert result["app_version"] == result["upstream_version"]
|
|
assert result["build_flavor"] == "wilkensxl"
|
|
assert result["version"] == result["build_version"]
|
|
checks = result["checks"]
|
|
for name in ("database", "data_dir", "local_first"):
|
|
assert name in checks, f"missing check: {name}"
|
|
|
|
# In the dev/test environment the local SQLite DB and data dir are present,
|
|
# so the critical checks must pass and overall readiness must be True.
|
|
assert checks["database"]["ok"] is True, checks["database"]
|
|
assert checks["data_dir"]["ok"] is True, checks["data_dir"]
|
|
assert result["ready"] is True, result
|
|
|
|
|
|
def test_local_first_check_is_informational_never_fatal():
|
|
result = check_readiness()
|
|
lf = result["checks"]["local_first"]
|
|
# local_first reports whether storage stays on-host but must never gate
|
|
# readiness — a remote database is a valid deployment.
|
|
assert lf["ok"] is True
|
|
assert "local" in lf
|