From 513b1bc469d8b9dbe579007acb816a0811bb061d Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Sat, 26 Sep 2026 20:41:05 +0530 Subject: [PATCH] test(backup): assert the integrity-failure message on corrupt import f55f937cee made run_import tell the user when an archived database fails its integrity check instead of blaming a live holder, but nothing asserted that message: reverting its prod hunk left the suite green. Extend the existing corrupt-source test to require "failed its integrity check" in the import output, so the misleading holder message cannot come back. Verified: 24 pass on head; 9 fail with f55f937cee's prod hunk reverted. --- tests/hermes_cli/test_restore_source_integrity.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/hermes_cli/test_restore_source_integrity.py b/tests/hermes_cli/test_restore_source_integrity.py index 55062959ba..b25c23e568 100644 --- a/tests/hermes_cli/test_restore_source_integrity.py +++ b/tests/hermes_cli/test_restore_source_integrity.py @@ -83,7 +83,9 @@ def test_restore_uses_literal_paths_and_preserves_live_connection( @pytest.mark.parametrize("entry", ["snapshot", "import"]) @pytest.mark.parametrize("damage", ["header", "btree", "truncated"]) -def test_corrupt_source_cannot_replace_a_healthy_database(tmp_path, home, entry, damage): +def test_corrupt_source_cannot_replace_a_healthy_database( + tmp_path, capsys, home, entry, damage +): live = home / "state.db" with closing(sqlite3.connect(live)) as db: db.execute("CREATE TABLE evidence(value TEXT)") @@ -113,6 +115,9 @@ def test_corrupt_source_cannot_replace_a_healthy_database(tmp_path, home, entry, inode = live.stat().st_ino assert not _restore(entry, home, snapshot_id, source) + if entry == "import": + captured = capsys.readouterr() + assert "failed its integrity check" in captured.out + captured.err assert live.read_bytes() == before assert live.stat().st_ino == inode