fix: fence final worker admission against UI shutdown
This commit is contained in:
1 parent
dbc685b9a5
commit
eabf61c73b
13 files changed
+356
-46
No files matched your search
@@ -83,6 +83,7 @@ def test_manual_repair_selects_diagnosed_bound_database_without_layout_or_health
|
||||
|
||||
|
||||
def test_versions_launcher_rechecks_parent_retained_lease_and_persists_before_gate(tmp_path, monkeypatch):
|
||||
import subprocess, sys
|
||||
from test_native_backup import project_fixture
|
||||
from cbb_refresh_verify import native_backup as native, library_lock, session_record
|
||||
request, project = project_fixture(tmp_path)
|
||||
@@ -90,13 +91,17 @@ def test_versions_launcher_rechecks_parent_retained_lease_and_persists_before_ga
|
||||
calls = []
|
||||
monkeypatch.setattr(library_lock, 'recheck_previous_release', lambda *a, **k: calls.append('recheck'))
|
||||
monkeypatch.setattr(session_record, 'process_identity', lambda pid: dict(pid=pid, created='now', executable='python', owner='test'))
|
||||
child = subprocess.Popen([sys.executable,'-c','input()'],stdin=subprocess.PIPE,text=True)
|
||||
def spawn(command, **kw):
|
||||
job = json.loads(Path(command[-1]).read_text())
|
||||
assert calls == ['recheck'] and not Path(job['start_gate']).exists()
|
||||
calls.append('spawn')
|
||||
return SimpleNamespace(pid=123, poll=lambda: None)
|
||||
return child
|
||||
monkeypatch.setattr(native.subprocess, 'Popen', spawn)
|
||||
session = native.launch_native_backup(request, mode='repair')
|
||||
try:
|
||||
session = native.launch_native_backup(request, mode='repair')
|
||||
finally:
|
||||
child.communicate('\n',timeout=5)
|
||||
record = json.loads(session.job.read_text())
|
||||
assert Path(record['start_gate']).is_file()
|
||||
assert Path(record['session_record_path']).is_file()
|
||||
@@ -213,6 +218,7 @@ def test_independent_backup_job_registration_retains_descendants_after_caller_ha
|
||||
|
||||
|
||||
def test_common_admission_refusal_publishes_bound_receipt_and_ui_can_reopen(qtbot, tmp_path, monkeypatch):
|
||||
import win32api
|
||||
from threading import Event, Thread
|
||||
from test_native_backup import project_fixture
|
||||
from test_ui_filters import load_window
|
||||
@@ -220,7 +226,8 @@ def test_common_admission_refusal_publishes_bound_receipt_and_ui_can_reopen(qtbo
|
||||
from cbb_refresh_verify.application import main
|
||||
request, _ = project_fixture(tmp_path)
|
||||
monkeypatch.setattr(native, 'native_backup_executable', lambda *_: tmp_path/'native.exe')
|
||||
monkeypatch.setattr(native.subprocess, 'Popen', lambda *a, **k: SimpleNamespace(pid=os.getpid(), poll=lambda: None))
|
||||
monkeypatch.setattr(native.subprocess, 'Popen', lambda *a, **k:
|
||||
SimpleNamespace(pid=os.getpid(), handle=win32api.GetCurrentProcess(), poll=lambda: None))
|
||||
session = native.launch_native_backup(request)
|
||||
entered, release = Event(), Event()
|
||||
monkeypatch.setattr(desktop_worker, '_automation_clients', [])
|
||||
|
||||
Reference in new issue
Block a user