fix: confine every reconstitute target to the exports directory and never overwrite an existing file
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
4
tests/fixtures/capture-mysql.py
vendored
4
tests/fixtures/capture-mysql.py
vendored
@@ -89,8 +89,8 @@ def main():
|
||||
assert result["phase"] == "dump_failed" and result["snapshot_id"] is None, result
|
||||
continue
|
||||
assert result["status"] == "completed", (name, result)
|
||||
target = root / f"{name}.sql"
|
||||
session = api("reconstitute", {"snapshot_id": result["snapshot_id"], "target_path": str(target)})
|
||||
target = root / "hub" / "exports" / f"{name}.sql"
|
||||
session = api("reconstitute", {"snapshot_id": result["snapshot_id"], "target_path": target.name})
|
||||
wait_until(lambda: api(f"reconstitute/{session['session_id']}")["state"] == "completed")
|
||||
sql = target.read_text()
|
||||
assert all(marker in sql for marker in ("sample_view", "sample_routine", "sample_event", "backup 🛰"))
|
||||
|
||||
4
tests/fixtures/capture-postgres.py
vendored
4
tests/fixtures/capture-postgres.py
vendored
@@ -125,8 +125,8 @@ def main():
|
||||
assert failed["snapshot_id"] is None
|
||||
snapshots = api("snapshots")
|
||||
assert {snap["id"] for snap in snapshots} == {successful["snapshot_id"], through_bastion["snapshot_id"]}
|
||||
dump = root / "backup.dump"
|
||||
session = api("reconstitute", {"snapshot_id": successful["snapshot_id"], "target_path": str(dump)})
|
||||
dump = root / "hub" / "exports" / "backup.dump"
|
||||
session = api("reconstitute", {"snapshot_id": successful["snapshot_id"], "target_path": dump.name})
|
||||
wait_until(lambda: api(f"reconstitute/{session['session_id']}")["state"] == "completed")
|
||||
command("pg_restore", *pg, "-d", "target_db", "--exit-on-error", dump)
|
||||
restored = command("psql", *pg, "-d", "target_db", "-Atc",
|
||||
|
||||
Reference in New Issue
Block a user