fix: preserve blocked state after rebuild cleanup failure
This commit is contained in:
1 parent
12895e9868
commit
7da623d055
5 files changed
+154
-3
No files matched your search
@@ -193,6 +193,29 @@ def test_prewrite_failure_releases_old_desktop_and_retries_only_once(tmp_path, m
|
||||
and release['released_at'] > 0 for release in releases)
|
||||
|
||||
|
||||
def test_rebuild_does_not_hide_cad_shutdown_failure(tmp_path):
|
||||
from dx_productivity.trial_task_center.batch_runtime import BatchCadRuntime
|
||||
from dx_productivity.trial_task_center.errors import TaskCenterError
|
||||
|
||||
class FailingCad(Cad):
|
||||
def __exit__(self, *_exc):
|
||||
self.closed = True
|
||||
self.desktop.close()
|
||||
raise OSError('CAD quit confirmation failed')
|
||||
|
||||
runtime = BatchCadRuntime(tmp_path / 'data', 'execution',
|
||||
desktop_factory=Desktop, cad_factory=FailingCad)
|
||||
runtime.__enter__()
|
||||
runtime._ensure_desktop()
|
||||
runtime._ensure_cad()
|
||||
with pytest.raises(TaskCenterError, match='CAD quit confirmation failed'):
|
||||
runtime.close(rebuilding=True)
|
||||
with pytest.raises(TaskCenterError, match='CAD quit confirmation failed'):
|
||||
runtime.__exit__(None, None, None)
|
||||
record = json.loads(runtime.path.read_text())
|
||||
assert record['state'] == 'blocked'
|
||||
|
||||
|
||||
def test_possible_mutation_prevents_automatic_replay(tmp_path, monkeypatch):
|
||||
from dx_productivity.trial_task_center.worker_monitor import WorkerMonitorError
|
||||
command, _ = command_for(tmp_path)
|
||||
|
||||
Reference in new issue
Block a user