feat: integrate native diagnostics and coordinated CBB transactions
This commit is contained in:
1 parent
9e230e1a46
commit
da67de026f
91 files changed
+14370
-435
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import json
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize('cancel,gate_present', [(False, False), (True, False), (True, True)])
|
||||
def test_worker_waits_for_cold_agent_but_cancellation_never_opens_pcb(tmp_path, monkeypatch, cancel, gate_present):
|
||||
from cbb_refresh_verify import mentor_adapter as adapter
|
||||
import pythoncom
|
||||
gate, stop = tmp_path/'start.signal', tmp_path/'cancel.signal'
|
||||
if gate_present: gate.touch()
|
||||
if cancel: stop.touch()
|
||||
clock, opened = [0.0], []
|
||||
def advance(seconds):
|
||||
clock[0] += seconds
|
||||
if not cancel and clock[0] >= 20: gate.touch()
|
||||
monkeypatch.setattr(adapter, 'time', SimpleNamespace(monotonic=lambda: clock[0], sleep=advance,
|
||||
strftime=lambda *_: 'test'))
|
||||
monkeypatch.setattr(pythoncom, 'CoInitialize', lambda: None)
|
||||
monkeypatch.setattr(pythoncom, 'CoUninitialize', lambda: None)
|
||||
monkeypatch.setattr(adapter, 'execute_job', lambda *args: opened.append(True) or {'status': 'PASS'})
|
||||
job = tmp_path/'request.json'
|
||||
job.write_text(json.dumps({'root': str(tmp_path), 'block_name': 'fixture',
|
||||
'start_gate': str(gate), 'cancel_signal': str(stop)}), encoding='utf-8')
|
||||
result = adapter.worker_main(job)
|
||||
assert result == (1 if cancel else 0)
|
||||
assert opened == ([] if cancel else [True])
|
||||
if cancel:
|
||||
outcome = json.loads((tmp_path/'outcome.json').read_text('utf-8'))
|
||||
assert 'VERIFY_CANCELLED' in outcome['stderr']
|
||||
Reference in new issue
Block a user