fix(safety): reject frozen queue policy changes before project backup
This commit is contained in:
1 parent
2c88be99ce
commit
0151552f55
2 files changed
+24
-2
No files matched your search
@@ -78,14 +78,19 @@ def test_result_for_other_queued_project_is_rejected(tmp_path):
|
||||
assert (tmp_path / 'quick-run/uncertain.flag').exists()
|
||||
|
||||
|
||||
def test_policy_change_cannot_reinterpret_partial_queue(tmp_path):
|
||||
def test_policy_change_cannot_reinterpret_partial_queue(tmp_path, monkeypatch):
|
||||
projects, rules = inputs()
|
||||
preparer = QuickRunPreparer(tmp_path, script_source=SOURCE)
|
||||
result = preparer.prepare('task', projects, rules)
|
||||
job = result.command_path.read_text(encoding='utf-8').splitlines()[1].split('\t')[1]
|
||||
result.status_path.write_text(f'job_id\tstate\tcode\tmessage\n{job}\tawaiting_native_replace\t\tcaptured\n', encoding='utf-8')
|
||||
before = {path.name: path.read_bytes() for path in result.command_path.parent.iterdir() if path.is_file()}
|
||||
from dx_productivity.trial_task_center import single_step
|
||||
monkeypatch.setattr(single_step, 'create_schematic_backup',
|
||||
lambda *a, **k: pytest.fail('frozen policy must be rejected before backup or CAD'))
|
||||
with pytest.raises(TaskCenterError, match='quick_run_pending'):
|
||||
preparer.execute_step('task', projects, rules, copy_part_number_to_value=True)
|
||||
assert before == {path.name: path.read_bytes() for path in result.command_path.parent.iterdir() if path.is_file()}
|
||||
|
||||
|
||||
def test_service_freezes_setting_after_queue_is_prepared(tmp_path):
|
||||
@@ -189,7 +194,7 @@ def test_serial_three_project_two_rule_queue_pins_each_job(tmp_path):
|
||||
assert preparer.progress('task', projects, rules).queue_complete
|
||||
|
||||
|
||||
def test_old_queue_snapshot_blocks_policy_reinterpretation_without_status(tmp_path):
|
||||
def test_old_queue_snapshot_blocks_policy_reinterpretation_without_status(tmp_path, monkeypatch):
|
||||
projects, rules = inputs()
|
||||
preparer = QuickRunPreparer(tmp_path, script_source=SOURCE)
|
||||
result = preparer.prepare('task', projects, rules)
|
||||
@@ -200,8 +205,13 @@ def test_old_queue_snapshot_blocks_policy_reinterpretation_without_status(tmp_pa
|
||||
encoding='utf-8',
|
||||
)
|
||||
(result.command_path.parent / 'snapshot-old.tsv').write_text('retained evidence', encoding='utf-8')
|
||||
before = {path.name: path.read_bytes() for path in result.command_path.parent.iterdir() if path.is_file()}
|
||||
from dx_productivity.trial_task_center import single_step
|
||||
monkeypatch.setattr(single_step, 'create_schematic_backup',
|
||||
lambda *a, **k: pytest.fail('legacy snapshot must be checked before backup or CAD'))
|
||||
with pytest.raises(TaskCenterError, match='quick_run_pending'):
|
||||
preparer.execute_step('task', projects, rules)
|
||||
assert before == {path.name: path.read_bytes() for path in result.command_path.parent.iterdir() if path.is_file()}
|
||||
|
||||
|
||||
def test_frozen_launcher_reserves_helper_script_slot(monkeypatch, tmp_path):
|
||||
|
||||
Reference in new issue
Block a user