fix: retry catalog when the blocking process exits
This commit is contained in:
1 parent
75612cd4da
commit
b015827e97
2 files changed
+37
-5
No files matched your search
@@ -223,6 +223,39 @@ def test_catalog_progress_and_pending_preview_are_visible(qtbot, tmp_path, monke
|
||||
window.pool.waitForDone(6000)
|
||||
|
||||
|
||||
def test_catalog_retries_when_exact_manager_pid_exits(qtbot, tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import owner_probe
|
||||
from cbb_refresh_verify.management import Catalog, CatalogEntry
|
||||
from cbb_refresh_verify.models import CbbRecord, LibraryReadResult
|
||||
from test_issue15_ui_integration import load, window_for
|
||||
|
||||
calls = []
|
||||
|
||||
def catalog(library, evidence):
|
||||
calls.append(evidence)
|
||||
if len(calls) == 1:
|
||||
raise native.NativeOperationError('LIBRARY_MANAGER_BUSY: PID 123', safe_to_continue=True,
|
||||
blocking_manager_pids=(123,))
|
||||
return Catalog(library, 1, (CatalogEntry('A', 'Logical-Physical'),))
|
||||
|
||||
monkeypatch.setattr(owner_probe, 'snapshot_process_ids', lambda _: [456])
|
||||
|
||||
def unavailable(*args, **kwargs):
|
||||
raise RuntimeError('OWNER_QUERY_TIMEOUT')
|
||||
|
||||
monkeypatch.setattr(owner_probe, 'query_owners', unavailable)
|
||||
window = window_for(qtbot, tmp_path, monkeypatch,
|
||||
reader=lambda _: LibraryReadResult((CbbRecord('A', 'LP'),), directory_count=1),
|
||||
catalog_reader=catalog, status_refresher=lambda names, _: dict.fromkeys(names, 'READY'))
|
||||
try:
|
||||
load(window, qtbot)
|
||||
qtbot.waitUntil(lambda: window.ready_names == {'A'}, timeout=1500)
|
||||
assert calls == [calls[0], calls[0] / 'retry']
|
||||
finally:
|
||||
window._cancel_catalog_read()
|
||||
window.pool.waitForDone(6000)
|
||||
|
||||
|
||||
def test_timed_out_catalog_can_refresh_already_registered_status_only(qtbot, tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify.management import Catalog, CatalogEntry
|
||||
from cbb_refresh_verify.models import CbbRecord, LibraryReadResult
|
||||
|
||||
Reference in new issue
Block a user