fix: distinguish native outcomes from report and item recovery status
This commit is contained in:
1 parent
5b22787418
commit
8c2c60fab1
4 files changed
+64
-5
No files matched your search
@@ -6,7 +6,7 @@ from test_maintenance_entry import case
|
||||
|
||||
def test_verify_defaults_to_no_repair_and_does_not_retain_a_failure_lock(tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import verify_runner as runner, library_lock as locks, native_repair
|
||||
library = tmp_path / 'library.lmc'; library.touch()
|
||||
library = tmp_path / 'library/library.lmc'; library.parent.mkdir(); library.touch()
|
||||
req = runner.VerifyRequest(library, 'CBB', tmp_path / 'evidence')
|
||||
assert req.auto_repair is False
|
||||
marker = locks.blocker_path(library)
|
||||
@@ -16,11 +16,17 @@ def test_verify_defaults_to_no_repair_and_does_not_retain_a_failure_lock(tmp_pat
|
||||
error_category='ICDB_REPAIR_REQUIRED', safe_to_continue=True)
|
||||
monkeypatch.setattr(runner, '_run_verify_serialized', lambda *a, **k: (calls.append('verify') or result))
|
||||
monkeypatch.setattr(native_repair, 'attempt_recovery', lambda *a, **k: pytest.fail('verify requested Repair'))
|
||||
assert runner.run_verify(req) is result
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda *_: [])
|
||||
monkeypatch.setattr('cbb_refresh_verify.native_engineering_identity._process_snapshot', lambda: [])
|
||||
first = runner.run_verify(req)
|
||||
assert first.status == result.status and first.error_category == result.error_category
|
||||
assert first.release_proof['status'] == 'RELEASE_CONFIRMED'
|
||||
assert runner.run_verify(req) is result
|
||||
assert calls == ['verify', 'verify']
|
||||
assert marker.read_text() == 'historical diagnostic record'
|
||||
assert locks._key(tmp_path / '.library.cbb-upload.lock') not in locks._owners
|
||||
assert not marker.exists()
|
||||
archive = Path(first.release_proof['evidence_path']).with_name('blocker-before-0.json')
|
||||
assert archive.read_text() == 'historical diagnostic record'
|
||||
assert locks._key(library.parent / '.library.cbb-upload.lock') not in locks._owners
|
||||
|
||||
|
||||
def test_catalog_checkpoint_does_not_disable_ordinary_verify(qtbot, tmp_path, monkeypatch):
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
from dataclasses import replace
|
||||
|
||||
from test_management import setup
|
||||
|
||||
|
||||
def test_released_item_failure_does_not_claim_entire_queue_stopped(qtbot, setup):
|
||||
from cbb_refresh_verify.management import ManagementResult
|
||||
from cbb_refresh_verify.ui.management_dialog import ManagementDialog
|
||||
request, _, _ = setup
|
||||
dialog=ManagementDialog([request]);qtbot.addWidget(dialog)
|
||||
result=ManagementResult(request.operation,request.library,request.name,request.partition,
|
||||
None,False,'complete','RECOVERY_REQUIRED',True,'native add failed')
|
||||
dialog._result([result])
|
||||
assert '需要人工恢复' in dialog.status_label.text()
|
||||
assert '队列已停止' not in dialog.status_label.text()
|
||||
|
||||
|
||||
def test_report_failure_is_visible_without_inventing_native_failure(qtbot, setup):
|
||||
from cbb_refresh_verify.management import ManagementResult
|
||||
from cbb_refresh_verify.ui.management_dialog import ManagementDialog
|
||||
request, _, _=setup
|
||||
dialog=ManagementDialog([request]);qtbot.addWidget(dialog)
|
||||
result=ManagementResult(request.operation,request.library,request.name,request.partition,
|
||||
None,False,'complete','REMOVED',True,'removed',release_proof={
|
||||
'status':'RELEASE_CONFIRMED','data_recovery_confirmed':False},
|
||||
change_report={'status':'UNCONFIRMED','detail':'report disk full'})
|
||||
dialog._result([result])
|
||||
assert '已移除' in dialog.status_label.text() and '变更清单待核对' in dialog.status_label.text()
|
||||
assert '历史会话已释放' in dialog.output.toPlainText()
|
||||
dialog._progress({'stage':'previous_release_check','block':request.name})
|
||||
assert '正在复核历史占用' in dialog.status_label.text()
|
||||
Reference in new issue
Block a user