[tests] fix flaky advertising proxy tests (#7105)

- double wait time for advertising proxy top update and multicast the
  SRP updates
- adjust waiting time to avoid collision with lease time schedule
- fully remove the service before starting next test case
- add debug logging
This commit is contained in:
kangping
2021-11-01 09:16:31 -07:00
committed by GitHub
parent 09dd21abca
commit ba08ed6f34
2 changed files with 23 additions and 5 deletions
@@ -181,12 +181,21 @@ class SingleHostAndService(thread_cert.TestCase):
#
client.srp_client_remove_service('my-service-1', '_ipps._tcp')
self.simulator.go(5)
# We previously had self.simulator.go(5) but got the issue that the client is scheduling
# the refresh timer with half of the lease time (10 seconds) and there will be chances
# that the client will be just in status "kToRefresh" after self.simulator.go(5). This will
# fail the checks in self.check_host_and_service() so updated to wait for 2 seconds.
self.simulator.go(2)
self.check_host_and_service(server, client, '2001::2', 'my-service')
self.host_check_mdns_service(host, '2001::2', 'my-service')
self.assertIsNone(host.discover_mdns_service('my-service-1', '_ipps._tcp', 'my-host'))
# Wait for KEY expiration of service 'my-service-1'.
# FIXME: workaround for https://github.com/openthread/ot-br-posix/issues/1071.
self.simulator.go(KEY_LEASE + 5)
#
# 8. Update both the host and the service in a loop and make sure the
# Advertising Proxy can follow.
@@ -197,7 +206,7 @@ class SingleHostAndService(thread_cert.TestCase):
client.srp_client_clear_service('my-service', '_ipps._tcp')
client.srp_client_set_host_address(host_address)
client.srp_client_add_service('my-service', '_ipps._tcp', service_port)
self.simulator.go(5)
self.simulator.go(10)
self.check_host_and_service(server, client, host_address, 'my-service', service_port)
self.host_check_mdns_service(host, host_address, 'my-service', service_port)