Some checks failed
continuous-integration/drone/push Build is failing
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 <noreply@anthropic.com>
29 lines
1.3 KiB
Python
29 lines
1.3 KiB
Python
"""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."
|
|
)
|