Protect manifest artifacts in RC10 audit
This commit is contained in:
@@ -146,6 +146,43 @@ def test_storage_audit_only_selects_old_unreferenced_allowlisted_files(
|
||||
assert "release-evidence" in report["cleanup"]["protected_prefixes"]
|
||||
|
||||
|
||||
def test_referenced_tile_manifest_protects_its_tiles(tmp_path: Path) -> None:
|
||||
audit = load_script("audit_data_operations.py")
|
||||
storage = tmp_path / "storage"
|
||||
manifest = storage / "tiles" / "dataset" / "set" / "manifest.json"
|
||||
tile = manifest.parent / "tile_0000.tif"
|
||||
tile.parent.mkdir(parents=True)
|
||||
tile.write_bytes(b"tile")
|
||||
manifest.write_text(json.dumps({"tiles": [{"path": "tile_0000.tif"}]}), encoding="utf-8")
|
||||
|
||||
expanded = audit.expand_manifest_references({manifest.resolve()}, storage)
|
||||
|
||||
assert manifest.resolve() in expanded
|
||||
assert tile.resolve() in expanded
|
||||
|
||||
|
||||
def test_disk_pressure_uses_absolute_headroom_for_large_arrays(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
audit = load_script("audit_data_operations.py")
|
||||
monkeypatch.setattr(
|
||||
audit.shutil,
|
||||
"disk_usage",
|
||||
lambda _path: SimpleNamespace(
|
||||
total=56 * 1024**4,
|
||||
used=(56 * 1024**4) - (700 * 1024**3),
|
||||
free=700 * 1024**3,
|
||||
),
|
||||
)
|
||||
|
||||
pressure = audit.disk_pressure(tmp_path)
|
||||
|
||||
assert pressure["free_percent"] < 2
|
||||
assert pressure["status"] == "ok"
|
||||
assert pressure["acquisition_allowed"] is True
|
||||
|
||||
|
||||
def test_source_family_report_covers_national_regional_and_maritime(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
|
||||
Reference in New Issue
Block a user