fix migration resume and release workflow

This commit is contained in:
2026-07-16 12:31:59 +03:00
parent 45ce585aba
commit 8f0d123ff8
32 changed files with 2046 additions and 163 deletions

View File

@@ -331,6 +331,53 @@ def test_transform_zip_end_to_end():
# #endregion test_transform_zip_end_to_end
# #region test_transform_zip_keeps_only_referenced_mapped_database [C:2] [TYPE Function]
# @BRIEF An exported archive must not import unused database resources or request their passwords.
# @TEST_EDGE unreferenced_database_with_password -> excluded from transformed archive.
def test_transform_zip_keeps_only_referenced_mapped_database():
engine = MigrationEngine()
with tempfile.TemporaryDirectory() as td:
root = Path(td)
source = root / "source.zip"
target = root / "target.zip"
archive = root / "archive"
(archive / "datasets").mkdir(parents=True)
(archive / "databases").mkdir()
(archive / "datasets" / "orders.yaml").write_text(
"database_uuid: source-used\ntable_name: orders\n"
)
(archive / "databases" / "used.yaml").write_text("uuid: source-used\n")
(archive / "databases" / "unrelated.yaml").write_text("uuid: source-unrelated\n")
with zipfile.ZipFile(source, "w") as zf:
for path in archive.rglob("*.yaml"):
zf.write(path, path.relative_to(archive))
assert engine.transform_zip(
str(source), str(target), {"source-used": "target-used"},
strip_databases=False,
)
with zipfile.ZipFile(target) as zf:
assert "databases/used.yaml" in zf.namelist()
assert "databases/unrelated.yaml" not in zf.namelist()
dataset = yaml.safe_load(zf.read("datasets/orders.yaml"))
assert dataset["database_uuid"] == "target-used"
def test_transform_zip_rejects_dataset_without_database_mapping():
"""@TEST_EDGE An unmapped dataset dependency cannot fall through to a password prompt."""
engine = MigrationEngine()
with tempfile.TemporaryDirectory() as td:
source = Path(td) / "source.zip"
target = Path(td) / "target.zip"
with zipfile.ZipFile(source, "w") as zf:
zf.writestr("datasets/orders.yaml", "database_uuid: source-unmapped\n")
zf.writestr("databases/unmapped.yaml", "uuid: source-unmapped\n")
assert not engine.transform_zip(str(source), str(target), {}, strip_databases=False)
assert not target.exists()
# #endregion test_transform_zip_keeps_only_referenced_mapped_database
# #region test_transform_zip_invalid_path [C:2] [TYPE Function]
# @RELATION BINDS_TO -> [TestMigrationEngine]
# @PURPOSE: Verify transform_zip returns False when source archive path does not exist.