fix: recover uncertain native failures and reopen long project paths safely
This commit is contained in:
1 parent
7f0ec29d31
commit
d832a1c736
15 files changed
+355
-36
No files matched your search
@@ -60,6 +60,25 @@ def run_queue(service, task, stop=None):
|
||||
return service.execute_quick_run_queue(task.task_id, expected_item=expected, stop_event=stop or Event())
|
||||
|
||||
|
||||
def test_native_mutation_failure_stops_before_next_batch_step(tmp_path):
|
||||
service, task, calls = setup_queue(tmp_path, ('batch_failed', 'saved_ok'))
|
||||
original_worker = service._quick_run_preparer._process_runner
|
||||
def failed_after_mutation(command, timeout):
|
||||
root = Path(command[3])
|
||||
job = command[-1]
|
||||
with (root / 'status.tsv').open('a', encoding='utf-8') as stream:
|
||||
stream.write(f'{job}\tawaiting_native_replace\t\tsnapshot captured\n')
|
||||
(root / f'snapshot-{job}.tsv.native.json').write_text(
|
||||
json.dumps({'ok': False, 'stage': 'pin_promotion_started'}), encoding='utf-8')
|
||||
return original_worker(command, timeout)
|
||||
service._quick_run_preparer._process_runner = failed_after_mutation
|
||||
with pytest.raises(TaskCenterError) as raised:
|
||||
run_queue(service, task)
|
||||
assert raised.value.code == 'quick_run_uncertain'
|
||||
assert len(calls) == 1
|
||||
assert (tmp_path / 'data/quick-run/uncertain.flag').exists()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('states', [('no_match',) * 20, ('no_match', 'saved_ok', 'no_match', 'saved_ok')])
|
||||
def test_queue_continues_after_misses_and_successes(tmp_path, states):
|
||||
service, task, calls = setup_queue(tmp_path, states)
|
||||
|
||||
Reference in new issue
Block a user