fix: isolate ICDB checks and recover scoped native sessions
This commit is contained in:
1 parent
1acfbd6374
commit
1bd7589fef
82 files changed
+7770
-1583
No files matched your search
@@ -80,6 +80,37 @@ def test_restart_shows_unfinished_without_starting_worker(qtbot, tmp_path):
|
||||
assert 'Block' in window.output.toPlainText()
|
||||
|
||||
|
||||
def test_previous_unsafe_result_allows_retry_and_requires_matching_release_proof(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify.management import Capability, ManagementResult
|
||||
adapter = SimpleNamespace(capabilities=lambda: {op: Capability(True, 'available')
|
||||
for op in ('add', 'update', 'remove')})
|
||||
window = load_window(qtbot, tmp_path, monkeypatch, management_adapter=adapter)
|
||||
library = Path(window.mentor_lmc_path or window.loaded_path)
|
||||
from cbb_refresh_verify.network_path import LibraryPathLease
|
||||
current = LibraryPathLease(library, library)
|
||||
current.retain_for_recovery()
|
||||
window.library_lease = current
|
||||
window._management_unsafe = True
|
||||
window._management_unsafe_library = library
|
||||
window.select_visible_button.click()
|
||||
assert window.remove_button.isEnabled(), 'A historical flag must not disable the fresh release check'
|
||||
window.remove_button.click()
|
||||
requests = window.management_dialog.requests()
|
||||
assert requests and all(r.check_previous_release for r in requests)
|
||||
result = ManagementResult('remove', library, 'Beta', 'Logical-Physical', None,
|
||||
False, 'complete', 'BLOCKED', True, 'prelaunch failure')
|
||||
window._management_completed([result])
|
||||
assert window._management_library_unsafe(library), 'An input failure does not prove the previous session released'
|
||||
assert current._retained_for_recovery
|
||||
proof = {'status': 'RELEASE_CONFIRMED', 'library': str(library), 'evidence_path': 'proof.json'}
|
||||
window._management_completed([replace(result, release_proof=proof)])
|
||||
qtbot.waitUntil(lambda: window._mapping_busy == 0)
|
||||
assert not window._management_library_unsafe(library)
|
||||
assert not current._retained_for_recovery
|
||||
window.management_dialog.reject()
|
||||
|
||||
|
||||
def test_historical_record_does_not_prevent_catalog_load_and_offers_checked_release(qtbot, tmp_path, monkeypatch):
|
||||
import pytest
|
||||
import cbb_refresh_verify.library_lock as locks
|
||||
@@ -95,9 +126,16 @@ def test_historical_record_does_not_prevent_catalog_load_and_offers_checked_rele
|
||||
assert window.release_library_button.isEnabled()
|
||||
assert locks.blocker_path(library).read_text() == '{}'
|
||||
calls = []
|
||||
monkeypatch.setattr(QMessageBox, 'question', lambda *a, **k: QMessageBox.Yes)
|
||||
monkeypatch.setattr(locks, 'release_retained_library', lambda *a:
|
||||
(calls.append(a) or {'status': 'RELEASE_CONFIRMED', 'evidence_path': 'proof.json'}))
|
||||
monkeypatch.setattr(locks, 'inspect_residual_sessions', lambda *a:
|
||||
{'library': str(library), 'sessions': []})
|
||||
monkeypatch.setattr(locks, 'release_residual_sessions', lambda *a, **kw:
|
||||
(calls.append(a) or {'status': 'RELEASE_CONFIRMED', 'sessions': [], 'proof':
|
||||
{'status': 'RELEASE_CONFIRMED', 'library': str(library), 'evidence_path': 'proof.json'}}))
|
||||
window.release_library_button.click()
|
||||
qtbot.waitUntil(lambda: not window.release_dialog.busy)
|
||||
assert not calls
|
||||
window.release_dialog.confirm_button.click()
|
||||
qtbot.waitUntil(lambda: not window.release_dialog.busy)
|
||||
window.release_dialog.close()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
assert len(calls) == 1 and 'proof.json' in window.output.toPlainText()
|
||||
Reference in new issue
Block a user