Admit onboard camera preview only after its acquisition producer is ready

This commit is contained in:
DCCONSTRUCTIONS
2026-09-07 16:44:38 +03:00
parent fa8ac760a1
commit 9e03404f23
5 changed files with 65 additions and 12 deletions
+15
View File
@@ -1984,3 +1984,18 @@ def test_service_publishes_two_dynamic_camera_rows_and_stale_stop_is_safe(
)
finally:
service.close()
def test_onboard_preview_never_spawns_a_camera_producer(tmp_path, monkeypatch):
gateway = _gateway(tmp_path, monkeypatch)
try:
selected = gateway.select("sensor.camera.right", "192.168.1.20")
monkeypatch.setattr(
gateway, "_spawn_selected_producer",
lambda: pytest.fail("an onboard preview must not own camera activation"),
)
with pytest.raises(RuntimeError, match="producer is not ready"):
gateway.open_delivery(selected["generation"], require_recording=True)
assert gateway.snapshot()["recording"]["producer_alive"] is False
finally:
gateway.close()