Skip to content

Commit ee3c7d7

Browse files
authored
test: cap helper get_service_info timeout in suppression test (~3.0s → ~1.85s) (#1708)
1 parent 6db1f91 commit ee3c7d7

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

tests/services/test_info.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,9 @@ def mock_incoming_msg(records: Iterable[r.DNSRecord]) -> r.DNSIncoming:
430430

431431
return r.DNSIncoming(generated.packets()[0])
432432

433-
def get_service_info_helper(zc, type, name):
433+
def get_service_info_helper(zc, type, name, timeout):
434434
nonlocal service_info
435-
service_info = zc.get_service_info(type, name)
435+
service_info = zc.get_service_info(type, name, timeout)
436436
service_info_event.set()
437437

438438
try:
@@ -453,9 +453,14 @@ def get_service_info_helper(zc, type, name):
453453
for question in seed_history_questions:
454454
zc.question_history.add_question_at_time(question, far_future, set())
455455

456+
# No answers ever come back (all queries are suppressed),
457+
# so cap the helper at the worst-case sum of the three
458+
# phase waits below plus margin instead of the 3000ms
459+
# default. Phase 3 waits ~1.6s (the 999ms QM gap plus
460+
# jitter and 500ms buffer); 1500ms covers it.
456461
helper_thread = threading.Thread(
457462
target=get_service_info_helper,
458-
args=(zc, service_type, service_name),
463+
args=(zc, service_type, service_name, 1500),
459464
)
460465
helper_thread.start()
461466
wait_time = (const._LISTENER_TIME + info._AVOID_SYNC_DELAY_RANDOM_INTERVAL[1] + 500) / 1000

0 commit comments

Comments
 (0)