fix: drop null vault keys, cap snapshot restore size, isolate test globals

Vaults.add_keys and kv add skip null content keys instead of failing the batch; is_null_key moves to core.vault. A manifest snapshot restore has one 32 MiB inflate budget. Tests reset the speed limiter and config between runs.
This commit is contained in:
imSp4rky
2026-11-02 22:01:02 -07:00
parent c4677341c8
commit 3027592e31
19 changed files with 170 additions and 81 deletions
+3
View File
@@ -26,6 +26,9 @@ def running(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> tuple[web.Applic
wvds.mkdir()
prds.mkdir()
(wvds / "dev.wvd").write_bytes(b"x")
# a valid reload replaces every config section, so put each one back for the next test
for name, value in list(vars(config).items()):
monkeypatch.setattr(config, name, value)
monkeypatch.setattr(config.directories, "wvds", wvds)
monkeypatch.setattr(config.directories, "prds", prds)
monkeypatch.setattr(config, "serve", {"api_secret": "api", "users": {"old": {"devices": ["dev"]}}})
@@ -15,16 +15,6 @@ requests_downloader = importlib.import_module("unshackle.core.downloaders.reques
pytestmark = pytest.mark.unit
@pytest.fixture(autouse=True)
def clean_limiter():
"""Start and end each test with no limiter, whatever an earlier test leaked."""
requests_downloader.speed_limit_locked = False
requests_downloader.speed_limiter = None
yield
requests_downloader.speed_limit_locked = False
requests_downloader.speed_limiter = None
@pytest.mark.parametrize(("lock", "expected"), [(True, 2_000_000.0), (False, None)])
def test_worker_share_of_limit(lock, expected):
requests_downloader.set_speed_limit(8_000_000, lock=lock)