[Thread] In Integration test, let the DNS client wait for DNS server to show up in Network Data

The bring up delay of SRP server is higher than before. In the integration test case we need to explicitly wait for the SRP server to show up in Network Data. Otherwise the test may be flaky.

Bug: 399263029
Change-Id: Id6346bcbfd55a34103ba8de0dcee75d3cacde446
This commit is contained in:
Handa Wang 2025-02-26 01:16:41 -08:00
commit b68f4ace76
2 changed files with 5 additions and 1 deletions

View file

@ -167,6 +167,8 @@ class InternetAccessTest {
val ftd = ftds[0]
joinNetworkAndWaitForOmr(ftd, DEFAULT_DATASET)
dnsServer.start()
ftd.autoStartSrpClient()
ftd.waitForSrpServer()
val ipv4Addresses =
ftd.resolveHost("google.com", TYPE_A).map { extractIpv4AddressFromMappedAddress(it) }
@ -181,6 +183,8 @@ class InternetAccessTest {
val ftd = ftds[0]
joinNetworkAndWaitForOmr(ftd, DEFAULT_DATASET)
dnsServer.start()
ftd.autoStartSrpClient()
ftd.waitForSrpServer()
assertThat(ftd.resolveHost("google.com", TYPE_A)).isEmpty()
assertThat(ftd.resolveHost("google.com", TYPE_AAAA)).isEmpty()

View file

@ -521,7 +521,7 @@ public final class FullThreadDevice {
}
/** Waits for an SRP server to be present in Network Data */
private void waitForSrpServer() throws TimeoutException {
public void waitForSrpServer() throws TimeoutException {
// CLI output:
// > srp client server
// [fd64:db12:25f4:7e0b:1bfc:6344:25ac:2dd7]:53538