Files
hermes-agent/tests/ci/test_cache_report.py
ethernet 63c1d815dd test(ci): trim cache coverage to two behavior checks
Remove the PM stdout and presentation suites and their log-building
helpers. Keep only receipt-based archive accounting and the real HTTP
token-isolation boundary. Display mode and identity/pairing matrices
are deliberately no longer maintained as automated tests.

Production code, including the existing local formatting amend, is
unchanged. Maintained new tests shrink from 383 to 72 lines.

Both survivors pass and catch all six injected accounting/auth faults
in an isolated checkout. All 12 checks pass for this test-only change.
2026-10-22 11:55:58 -04:00

39 lines
1.2 KiB
Python

"""Protect archive accounting, not report wording or markup."""
from scripts.ci.cache_report import parse_cache_log
def test_cache_accounting() -> None:
log = """##[group]Run actions/cache@fixture
##[endgroup]
Cache hit for: hit
Received 0 of 100 (0.0%), 0.0 MBs/sec
Received 100 of 100 (100.0%), 1.0 MBs/sec
Cache restored from key: hit
##[group]Run actions/cache@fixture
##[endgroup]
Cache not found for input keys: miss
Post job cleanup.
Sent 0 of 200 (0.0%), 0.0 MBs/sec
Sent 200 of 200 (100.0%), 1.0 MBs/sec
Cache saved with key: miss
##[group]Run actions/cache@fixture
##[endgroup]
Cache hit for: failed
Received 80 of 80 (100.0%), 1.0 MBs/sec
##[warning]Failed to restore: tar failed
Post job cleanup.
Sent 90 of 90 (100.0%), 1.0 MBs/sec
##[group]Run actions/cache@fixture
##[endgroup]
Cache hit for: unknown
Cache restored from key: unknown
"""
entries = parse_cache_log(log)
assert [(e["restore_status"], e["restored_bytes"], e["save_status"], e["saved_bytes"])
for e in entries] == [
("exact", 100, "not-attempted", None),
("miss", None, "saved", 200),
("failed", None, "unknown", None),
("exact", None, "not-attempted", None),
]