Finish Knative reef admission workplan
This commit is contained in:
parent
55de6c936a
commit
7751e5f043
8 changed files with 178 additions and 20 deletions
Binary file not shown.
33
tests/test_admission_freshness.py
Normal file
33
tests/test_admission_freshness.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import datetime as dt
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
MODULE = Path(__file__).parents[1] / "tools/check_admission_freshness.py"
|
||||
spec = importlib.util.spec_from_file_location("freshness", MODULE)
|
||||
freshness = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(freshness)
|
||||
|
||||
|
||||
def record(state="verified", status="pass", risk="open"):
|
||||
return {
|
||||
"checked_at": "2026-07-26T18:00:00Z",
|
||||
"readiness_state": state,
|
||||
"checks": {"compatibility": {"status": status}},
|
||||
"residual_risks": [{"risk": "single node", "status": risk}],
|
||||
}
|
||||
|
||||
|
||||
def test_verified_may_retain_explicit_open_risk():
|
||||
now = dt.datetime(2026, 7, 26, 19, tzinfo=dt.timezone.utc)
|
||||
assert freshness.assess(record(), now, 24) == []
|
||||
|
||||
|
||||
def test_production_approval_fails_closed():
|
||||
now = dt.datetime(2026, 7, 26, 19, tzinfo=dt.timezone.utc)
|
||||
failures = freshness.assess(record("production-approved", "unknown"), now, 24)
|
||||
assert len(failures) == 2
|
||||
|
||||
|
||||
def test_stale_evidence_fails():
|
||||
now = dt.datetime(2026, 7, 28, 19, tzinfo=dt.timezone.utc)
|
||||
assert "evidence is stale" in freshness.assess(record(), now, 24)
|
||||
Loading…
Add table
Add a link
Reference in a new issue