Merge "make floating IP specification test robust to races"
This commit is contained in:
commit
9ebc4f0453
|
@ -140,10 +140,20 @@ class FloatingIPAdminTestJSON(base.BaseAdminNetworkTest):
|
|||
@test.attr(type='smoke')
|
||||
@test.idempotent_id('332a8ae4-402e-4b98-bb6f-532e5a87b8e0')
|
||||
def test_create_floatingip_with_specified_ip_address(self):
|
||||
fip = self.get_unused_ip(self.ext_net_id, ip_version=4)
|
||||
body = self.admin_client.create_floatingip(
|
||||
floating_network_id=self.ext_net_id,
|
||||
floating_ip_address=fip)
|
||||
# other tests may end up stealing the IP before we can use it
|
||||
# since it's on the external network so we need to retry if it's
|
||||
# in use.
|
||||
for i in range(100):
|
||||
fip = self.get_unused_ip(self.ext_net_id, ip_version=4)
|
||||
try:
|
||||
body = self.admin_client.create_floatingip(
|
||||
floating_network_id=self.ext_net_id,
|
||||
floating_ip_address=fip)
|
||||
break
|
||||
except lib_exc.Conflict:
|
||||
pass
|
||||
else:
|
||||
self.fail("Could not get an unused IP after 100 attempts")
|
||||
created_floating_ip = body['floatingip']
|
||||
self.addCleanup(self.admin_client.delete_floatingip,
|
||||
created_floating_ip['id'])
|
||||
|
|
Loading…
Reference in New Issue