Skip to content

Commit c18b03a

Browse files
author
Maksym Shtembuliak
committed
test: await stable HA entry before connection strategy transition
1 parent 7e8cbf1 commit c18b03a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎tests_ha/test_ha_strategy_transition_options.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,15 @@ async def test_options_strategy_transition_inbound_to_callback(
182182
await coordinator.async_refresh()
183183
snapshot = coordinator.data
184184
if snapshot is not None and snapshot.connected:
185-
break
185+
# Connected data may belong to the coordinator that just
186+
# scheduled its first-metadata reload. Drain HA's lifecycle
187+
# before opening options; do not race a legitimate runtime
188+
# unavailable guard (especially on HA 2026.2).
189+
await hass.async_block_till_done()
190+
if (entry.state is ConfigEntryState.LOADED
191+
and entry.runtime_data is coordinator
192+
and not coordinator._entity_platform_reload_requested):
193+
break
186194
if not service._connection_alive():
187195
await service.handle_discovery(redirect, ("127.0.0.1", 0))
188196
assert (

0 commit comments

Comments
 (0)