Skip to content

Commit

Permalink
Send two ICMPv6 probes, each time we start a server
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
href committed Sep 30, 2024
1 parent 67ce41d commit b333d52
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit b333d52

Please sign in to comment.