Push builds have been RED on the lint step since ~build 209 from accumulated formatting drift. This is the mechanical cleanup: ruff format + ruff --fix (UP038 isinstance unions, SIM105 contextlib.suppress, UP031 f-strings, SIM115 tempfile context manager), shfmt -i 2 -ci, nixpkgs-fmt/statix/deadnix (merged attrsets, dropped unused lib args), yamllint, and shell quoting fixes in tests/lasuite-docs/setup_custom_tests.sh. No behaviour changes intended; lint: PASS, unit tests: 138 passed.
31 lines
1.4 KiB
Python
31 lines
1.4 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."
|
|
)
|