Skip to content

Commit 2e3d704

Browse files
committed
test(sync): add guard-name compatibility wrapper
1 parent da35de1 commit 2e3d704

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/sync/test_sync_authority_compare.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,29 @@ def test_compare_authority_parity(tmp_path, monkeypatch):
3434
# Set authority to compare (use monkeypatch via os.environ for simple test)
3535
monkeypatch.setenv("SHIELDCRAFT_SYNC_AUTHORITY", "compare")
3636

37+
res = verify_repo_state_authoritative(str(tmp_path))
38+
assert res.get("ok") is True
39+
assert res.get("authority") == "compare"
40+
41+
42+
def test_sync_authority_compare(tmp_path, monkeypatch):
43+
# Thin wrapper to provide the exact test name required by CI's guard
44+
from shieldcraft.snapshot import generate_snapshot
45+
m = generate_snapshot(str(tmp_path))
46+
os.makedirs(tmp_path / "artifacts", exist_ok=True)
47+
artifact_path = tmp_path / "artifacts" / "repo_sync_state.json"
48+
with open(artifact_path, "w") as f:
49+
json.dump(m, f, sort_keys=True)
50+
h = hashlib.sha256(open(artifact_path, "rb").read()).hexdigest()
51+
repo_state = {"files": [{"path": "artifacts/repo_sync_state.json", "sha256": h}]}
52+
with open(tmp_path / "repo_state_sync.json", "w") as f:
53+
json.dump(repo_state, f)
54+
55+
from shieldcraft.services.sync import _canonical_manifest_hash, verify_repo_state_authoritative
56+
assert _canonical_manifest_hash(m) == h
57+
58+
monkeypatch.setenv("SHIELDCRAFT_SYNC_AUTHORITY", "compare")
59+
3760
res = verify_repo_state_authoritative(str(tmp_path))
3861
assert res.get("ok") is True
3962
assert res.get("authority") == "compare"

0 commit comments

Comments
 (0)