@@ -461,26 +461,27 @@ def get_service_info_helper(zc, type, name):
461461 # by the question history
462462 last_sent = None
463463 send_event .clear ()
464+ # Seed the history before the next scheduled query (200ms +
465+ # randint(20, 120) after the first one) can fire. Without
466+ # this, slow macOS/Windows runners can race: the loop's
467+ # first wait_time*0.25 wait hasn't timed out yet when the
468+ # second query is sent, so the test sees 4 unsuppressed
469+ # questions instead of 1.
470+ seed_history_questions = (
471+ r .DNSQuestion (service_name , const ._TYPE_A , const ._CLASS_IN ),
472+ r .DNSQuestion (service_name , const ._TYPE_AAAA , const ._CLASS_IN ),
473+ r .DNSQuestion (service_name , const ._TYPE_TXT , const ._CLASS_IN ),
474+ )
475+ now = r .current_time_millis ()
476+ for question in seed_history_questions :
477+ zc .question_history .add_question_at_time (question , now , set ())
464478 for _ in range (3 ):
465479 send_event .wait (
466480 wait_time * 0.25
467481 ) # Wait long enough to be inside the question history window
468482 now = r .current_time_millis ()
469- zc .question_history .add_question_at_time (
470- r .DNSQuestion (service_name , const ._TYPE_A , const ._CLASS_IN ),
471- now ,
472- set (),
473- )
474- zc .question_history .add_question_at_time (
475- r .DNSQuestion (service_name , const ._TYPE_AAAA , const ._CLASS_IN ),
476- now ,
477- set (),
478- )
479- zc .question_history .add_question_at_time (
480- r .DNSQuestion (service_name , const ._TYPE_TXT , const ._CLASS_IN ),
481- now ,
482- set (),
483- )
483+ for question in seed_history_questions :
484+ zc .question_history .add_question_at_time (question , now , set ())
484485 send_event .wait (wait_time * 0.25 )
485486 assert last_sent is not None
486487 assert len (last_sent .questions ) == 1 # type: ignore[unreachable]
0 commit comments