From b333d529b52b8866d1662e5ad2ec40da8867c573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Krienb=C3=BChl?= Date: Mon, 30 Sep 2024 14:30:13 +0200 Subject: [PATCH] Send two ICMPv6 probes, each time we start a server We wait between probes, to ensure that the behavior matches our expectations. This adds an extra delay to some tests, but this should only happen in rare cases. --- resources.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/resources.py b/resources.py index a0a858e..c19e52e 100644 --- a/resources.py +++ b/resources.py @@ -313,7 +313,17 @@ def create_host(self, timeout): # address. A DNS lookup is used for it, to not hard-code the # address. The DNS lookup is usually done via IPv4 on the host. ipv6_address = self.resolve('api.cloudscale.ch', version=6)[0] - self.ping(ipv6_address, tries=10, wait=2) + + try: + self.ping(ipv6_address, tries=1, wait=1) + except AssertionError: + + # In the vast majority of cases, the ping probe works on the + # first attempt. If it does not, we have to wait for up to 16s + # for the neighbor cache on the switches to expire. + time.sleep(16) + + self.ping(ipv6_address, tries=1, wait=1) @with_trigger('server.wait-for-cloud-init') def wait_for_cloud_init(self, host, timeout):