Bound semantic worker storage and add verified evidence closeout
This commit is contained in:
@@ -246,3 +246,33 @@ def test_source_read_retries_transport_only(preparer):
|
||||
"source": "verified"
|
||||
}
|
||||
assert len(calls) == 5
|
||||
|
||||
|
||||
def test_closeout_failure_retains_released_marker_until_retry(preparer, monkeypatch, tmp_path):
|
||||
marker, output = outbox(preparer, monkeypatch, tmp_path)
|
||||
record = preparer.read_json(marker)
|
||||
record["retention"] = dict(
|
||||
root=str(output), archive_root=str(tmp_path / "archives"), archive_limit=1024**3, reserve=0
|
||||
)
|
||||
preparer.write_json(marker, record)
|
||||
actions = []
|
||||
|
||||
class Client:
|
||||
def request(self, path, body):
|
||||
actions.append(body["action"])
|
||||
return {}
|
||||
|
||||
close = preparer.closeout
|
||||
monkeypatch.setattr(
|
||||
preparer, "closeout", lambda *a, **kw: (_ for _ in ()).throw(OSError("archive unavailable"))
|
||||
)
|
||||
with pytest.raises(OSError):
|
||||
preparer.reconcile(Client(), marker)
|
||||
assert preparer.read_json(marker)["released"] is True
|
||||
assert (output / "urban-map.json").exists()
|
||||
monkeypatch.setattr(preparer, "closeout", close)
|
||||
preparer.reconcile(Client(), marker)
|
||||
assert actions == ["complete", "release"]
|
||||
assert not marker.exists()
|
||||
assert (output / "urban-map.json").exists()
|
||||
assert (output / "ARCHIVED.json").exists()
|
||||
|
||||
Reference in New Issue
Block a user