1111# under the License.
1212
1313import json
14+ import time
1415import uuid
1516
1617from tempest .lib import exceptions
@@ -255,10 +256,24 @@ def test_server_attach_detach_floating_ip(self):
255256 floating_ip
256257 )
257258 self .assertEqual ("" , raw_output )
258- cmd_output = json .loads (self .openstack (
259- 'server show -f json ' +
260- name
261- ))
259+
260+ # Loop a few times since this is timing-sensitive
261+ # Just hard-code it for now, since there is no pause and it is
262+ # racy we shouldn't have to wait too long, a minute seems reasonable
263+ wait_time = 0
264+ while wait_time < 60 :
265+ cmd_output = json .loads (self .openstack (
266+ 'server show -f json ' +
267+ name
268+ ))
269+ if floating_ip not in cmd_output ['addresses' ]:
270+ # Hang out for a bit and try again
271+ print ('retrying floating IP check' )
272+ wait_time += 10
273+ time .sleep (10 )
274+ else :
275+ break
276+
262277 self .assertIn (
263278 floating_ip ,
264279 cmd_output ['addresses' ],
@@ -272,6 +287,23 @@ def test_server_attach_detach_floating_ip(self):
272287 )
273288 self .assertEqual ("" , raw_output )
274289
290+ # Loop a few times since this is timing-sensitive
291+ # Just hard-code it for now, since there is no pause and it is
292+ # racy we shouldn't have to wait too long, a minute seems reasonable
293+ wait_time = 0
294+ while wait_time < 60 :
295+ cmd_output = json .loads (self .openstack (
296+ 'server show -f json ' +
297+ name
298+ ))
299+ if floating_ip in cmd_output ['addresses' ]:
300+ # Hang out for a bit and try again
301+ print ('retrying floating IP check' )
302+ wait_time += 10
303+ time .sleep (10 )
304+ else :
305+ break
306+
275307 cmd_output = json .loads (self .openstack (
276308 'server show -f json ' +
277309 name
0 commit comments