Files
cc-ci/tests/ghost/test_backup.py
autonomic-bot b4d03ccafe feat(2): ghost P4 data-integrity overlay (MySQL ci_marker) + §4.3 create-post round-trip
- ops.py + test_{upgrade,backup,restore}.py: seed ci_marker into the MySQL `ghost` DB (db service)
  via the mysql CLI; rides the recipe's mysqldump --tab backup. recipe is MySQL not sqlite (stale
  comment fixed). Expect restore RED -> recipe-PR (no backupbot.restore hook; immich/mattermost class).
- functional/_ghost.py: cookie-aware Ghost Admin API client (stdlib http.cookiejar; Origin CSRF hdr).
- functional/test_post_roundtrip.py: §4.3 create published post + read back (unique marker, non-vacuous);
  closes the DEFERRED ghost create-post item.
- PARITY.md + recipe_meta.py updated. Authored node-free; full-lifecycle run next, NOT yet claimed.
2026-05-30 04:14:13 +01:00

29 lines
1.1 KiB
Python

"""ghost — BACKUP overlay (Phase 1e HC3 / Phase 2 P4): assertion-only + additive.
ops.pre_backup seeded ci_marker='original' into the MySQL `ghost` DB before the backup op (the
recipe's backupbot pre-hook runs `mysqldump ... ghost --tab /var/lib/mysql-files/`, dumping every
`ghost` table — including ci_marker — into the backed-up path). The orchestrator performed the
backup once. This overlay ADDS: the seeded row is intact in the live DB at backup time. The
backup→restore divergence (dropping the table) is in ops.pre_restore.
"""
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner"))
from harness import lifecycle # noqa: E402
def _mysql(domain, sql):
cmd = (
'MYSQL_PWD="$(cat /run/secrets/db_password)" '
f'mysql -u root -N -s ghost -e "{sql}"'
)
return lifecycle.exec_in_app(domain, ["sh", "-c", cmd], service="db").strip()
def test_backup_captures_state(live_app):
assert _mysql(live_app, "SELECT v FROM ci_marker;") == "original", (
"the seeded ghost MySQL marker was not present at backup time"
)