"""custom-html-bkp-bad — RESTORE assertion (bad-restore RED canary). pre_restore seeds 'mutated' to ci-marker.txt. The backup snapshot has no ci-marker.txt (never seeded by pre_backup). After restore, the marker is either MISSING or 'mutated' — never 'original' — so this assertion FAILS → restore tier RED. """ import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner")) from harness import lifecycle # noqa: E402 MARKER_PATH = "/usr/share/nginx/html/ci-marker.txt" def test_restore_returns_state(live_app): result = lifecycle.exec_in_app( live_app, ["sh", "-c", f"cat {MARKER_PATH} 2>/dev/null || echo MISSING"] ).strip() assert result == "original", ( f"restore did not return the pre-mutation (backed-up) state: got {result!r}. " "Expected 'original'. The backup had no marker (not seeded by pre_backup), so " "restore cannot recover it — this is the intended failure for the bad-restore RED canary." )