Commit aaf120e
committed
test: drop pending multicast responses before TOCTOU assertion
`test_service_info_async_request` patches `_is_complete` to False
to keep `async_request` looping. With `quick_timing`, the earlier
`async_get_service_info` queries leave multicast responses pending
in `out_queue` / `out_delay_queue` that snapshot the records as
they were *before* `async_update_service` swapped the registry
to `new_info`. When those stale answers flush after
`_clear_cache` they re-cache
`xxxyyy._test1-srvc-type._tcp.local. -> ash-1.local. -> 10.0.1.2`
and point `aiosinfo.server` at `ash-1.local.`. The patched loop
then keeps asking for an A record nobody answers, so the final
state stays on `10.0.1.2`:
AssertionError: assert [b'\\n\\x00\\x01\\x02'] == [b'\\n\\x00\\x01\\x03']
Drop the pending entries from both queues before clearing the
cache. The already-scheduled `loop.call_at` for each queue fires
on the empty deque and is a no-op, so this is deterministic and
adds no wall-clock delay.1 parent dd341a3 commit aaf120e
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
695 | 695 | | |
696 | 696 | | |
697 | 697 | | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
698 | 708 | | |
699 | 709 | | |
700 | 710 | | |
| |||
0 commit comments