test(metrics): fix attestation-event test freshness time-bomb (use now vs hardcoded date)
acdl-ci / Lint (push) Successful in 12s
acdl-ci / Platform check-only (offline) (push) Successful in 31s
acdl-ci / Test (push) Failing after 47s

This commit is contained in:
Jon Chery
2026-08-12 21:07:50 +00:00
parent be967783b4
commit 8c68d683c6
+8 -4
View File
@@ -205,11 +205,15 @@ def test_attestation_event_emission(tmp_metrics):
# Dev skips (autonomous) — no event
ok, reason = attest("cid-attest-1", "dev", "testuser")
assert ok
# QA requires approver + attestation matrix — mock evidence
# QA requires approver + attestation matrix — mock evidence with
# fresh timestamps (relative to now, not hardcoded — avoids the
# time-bomb where fixed dates age out of the freshness window).
import datetime
now = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
ok, reason = attest("cid-attest-2", "qa", "testuser",
evidence={"functional_correctness": {"timestamp": "2026-08-04T12:00:00Z", "type": "test", "payload": {}},
"performance_baseline": {"timestamp": "2026-08-04T12:00:00Z", "type": "test", "payload": {}},
"security_posture": {"timestamp": "2026-08-04T12:00:00Z", "type": "test", "payload": {}},
evidence={"functional_correctness": {"timestamp": now, "type": "test", "payload": {}},
"performance_baseline": {"timestamp": now, "type": "test", "payload": {}},
"security_posture": {"timestamp": now, "type": "test", "payload": {}},
"contract_nfrs": {"valid": True}})
assert ok
# Check the attestation event was emitted