[Test] Deflake ResolverTest#GetAddrInfoV4_deferred_resp
There are two threads in the test that will set different DNS servers and send queries to the DNS resolver. It relies on a 100ms sleep between the two threads. When the problem occurs, the work of the first thread is somehow delayed, causing the second thread's DNS query to be sent to the DNS server configured by the first thread. Expected behavior: 1. Thread 1 create. 2. Thread 1 set DNS server to 127.0.0.10. 3. Thread 1 send DNS query to 127.0.0.10. 4. Thread 2 create. 5. Thread 2 set DNS server to 127.0.0.11. 6. Thread 2 send DNS query to 127.0.0.11. Failed case: 1. Thread 1 create (and then being delayed for over than 100ms) 2. Thread 2 create. 3. Thread 2 set DNS server to 127.0.0.11. 4. Thread 1 set DNS server to 127.0.0.10. 5. Thread 2 send DNS query to 127.0.0.10. <-- NG 6. Thread 1 send DNS query to 127.0.0.10. Replacing unreliable sleep by a boolean flag. Bug: 303371206 Bug: 302623174 Test: atest resolv_integration_test Change-Id: I56222894a8600c7cb4c1911dd453756d6069bd02
Loading