mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-08-18 19:02:33 +01:00
The test started the _adjust_system_datetime() task and used a fixed asyncio.sleep(0.1) before emitting the systemd-timesyncd PropertiesChanged signal that wait_for_active_state() waits on. On a busy CI runner the task could still be short of installing its D-Bus signal subscription when the signal fired, so the signal was broadcast to no subscriber and lost. wait_for_signal() then blocked until the 10s pytest-timeout killed it. Replace the sleep with a deterministic handshake: the SystemdUnit mock now exposes an active_state_read Event, set whenever ActiveState is queried. Inside wait_for_active_state() that read happens only after the PropertiesChanged subscription is installed, so awaiting the Event before emitting guarantees the signal cannot be missed. Verified under full CPU load: the old sleep-based sync point timed out 10/10, the Event-based version passed 30/30. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>