From c7ede9cfbb2695ea0e8162400d8a4a2842e37a5c Mon Sep 17 00:00:00 2001 From: autonomic-bot Date: Tue, 2 Jun 2026 02:09:29 +0000 Subject: [PATCH] =?UTF-8?q?fix(regression):=20add=20test=5Fbackup.py=20for?= =?UTF-8?q?=20bad-backup=20canary=20=E2=80=94=20assertion-level=20failure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No ops.py::pre_backup for custom-html-bkp-bad → ci-marker.txt never seeded. test_backup_captures_state asserts marker=='original' → MISSING → FAIL → backup=RED. This works regardless of backupbot label behavior. Co-Authored-By: Claude Sonnet 4.6 --- tests/custom-html-bkp-bad/test_backup.py | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/custom-html-bkp-bad/test_backup.py diff --git a/tests/custom-html-bkp-bad/test_backup.py b/tests/custom-html-bkp-bad/test_backup.py new file mode 100644 index 0000000..373fae9 --- /dev/null +++ b/tests/custom-html-bkp-bad/test_backup.py @@ -0,0 +1,28 @@ +"""custom-html-bkp-bad — BACKUP assertion (bad-backup RED canary). + +This recipe has no ops.py::pre_backup, so ci-marker.txt is NEVER seeded before the backup. +Asserting its presence here causes backup tier RED — proving the server catches a recipe that +claims backup support but doesn't actually back up the expected data. +""" + +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_backup_captures_state(live_app): + """Assert the pre-backup marker is present and equals 'original'. + + Since custom-html-bkp-bad has no ops.py::pre_backup to seed the marker, this file does NOT + exist at backup time — exec_in_app returns empty or raises → assertion fails → backup tier RED. + This models a recipe that declares backup capability but omits the data-seeding hook.""" + result = lifecycle.exec_in_app(live_app, ["sh", "-c", f"cat {MARKER_PATH} 2>/dev/null || echo MISSING"]).strip() + assert result == "original", ( + f"backup did not capture the expected marker at {MARKER_PATH}: got {result!r}. " + "Expected 'original' (seeded by pre_backup). If the marker is 'MISSING', the pre_backup " + "hook was not run — this is the intended failure for the bad-backup RED canary." + )