fix(host-agent): advertise connected devices
This commit is contained in:
@@ -9,6 +9,11 @@ from host_agent.config import HostAgentConfig
|
||||
from host_agent.heartbeat import HeartbeatSynchronizer, build_device_snapshot
|
||||
|
||||
|
||||
class ConnectableDriver:
|
||||
def connect(self) -> None:
|
||||
return None
|
||||
|
||||
|
||||
def _config() -> HostAgentConfig:
|
||||
return HostAgentConfig(
|
||||
control_plane_url="https://control.example",
|
||||
@@ -38,7 +43,7 @@ def test_build_device_snapshot_copies_complete_non_secret_state() -> None:
|
||||
|
||||
assert [device.device_id for device in snapshot] == ["device-a", "device-b"]
|
||||
assert snapshot[1].driver_type == "appium"
|
||||
assert snapshot[1].status == "busy"
|
||||
assert snapshot[1].status == "idle"
|
||||
assert snapshot[1].capability_tags == ["android", "physical"]
|
||||
assert "must-not-leave-host" not in repr(snapshot)
|
||||
|
||||
@@ -47,7 +52,7 @@ def test_heartbeat_synchronizer_runs_at_configured_interval_until_stopped() -> N
|
||||
manager = DeviceManager()
|
||||
manager.register_device(
|
||||
"device-a",
|
||||
lambda: object(), # type: ignore[arg-type,return-value]
|
||||
lambda: ConnectableDriver(), # type: ignore[arg-type,return-value]
|
||||
)
|
||||
calls: list[list[str]] = []
|
||||
|
||||
@@ -75,3 +80,4 @@ def test_heartbeat_synchronizer_runs_at_configured_interval_until_stopped() -> N
|
||||
|
||||
asyncio.run(scenario())
|
||||
assert calls == [["device-a"], ["device-a"], ["device-a"]]
|
||||
assert manager.status("device-a") == "busy"
|
||||
|
||||
Reference in New Issue
Block a user