Skip to content

Commit 4fb1005

Browse files
committed
test: synchronise test_integration on browser first-query
After #1760 shaved the probe random wait on loopback, async_register_service can finish faster than the ServiceBrowser fires its first startup query. The test asserts `len(answers[0]) == 0` (the initial outbound query carries no known PTR) — when the cache already holds the registered service by the time the first query is built, RFC 6762 §7.1 known-answer suppression makes that assertion racy. Wait for `got_query` once before calling `async_register_service` so the first startup query (built against an empty cache) is guaranteed to fire before the registration lands. Then clear the event and proceed.
1 parent 78670f7 commit 4fb1005

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/test_asyncio.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,12 @@ def send(out, addr=const._MDNS_ADDR, port=const._MDNS_PORT, v6_flow_scope=()):
10661066
"ash-2.local.",
10671067
addresses=[socket.inet_aton("10.0.1.2")],
10681068
)
1069+
# Wait for the browser's first startup query to land (with an empty
1070+
# cache) before registering — otherwise on fast loopback the register
1071+
# may finish before the first query fires, and answers[0] picks up
1072+
# the known PTR via RFC 6762 §7.1 known-answer suppression.
1073+
await asyncio.wait_for(got_query.wait(), 1)
1074+
got_query.clear()
10691075
task = await aio_zeroconf_registrar.async_register_service(info)
10701076
await task
10711077
loop = asyncio.get_running_loop()

0 commit comments

Comments
 (0)