Wait for floating_ip to detach from server after deletion

test_minimum_basic_scenario expects floating_ip detaching
from server immediately after deletion, and this may not
be true in production clouds(we watched in our system that
it took about 5 seconds for the floating_ip to disappear
from server's address). So this is to add wait after
floating_ip deletion.

Change-Id: Iedc6197829f2cb388878fdb8e257489482a41d93
This commit is contained in:
zhufl 2016-09-27 11:33:23 +08:00
parent 4f5e426d10
commit c310b8d634

View File

@ -149,10 +149,18 @@ class TestMinimumBasicScenario(manager.ScenarioTest):
# delete the floating IP, this should refresh the server addresses
self.compute_floating_ips_client.delete_floating_ip(floating_ip['id'])
server = self.servers_client.show_server(server['id'])['server']
def is_floating_ip_detached_from_server():
server_info = self.servers_client.show_server(
server['id'])['server']
address = self._get_floating_ip_in_server_addresses(
floating_ip, server)
self.assertIsNone(
address,
"Floating IP '%s' should not be in server addresses: %s" %
floating_ip, server_info)
return (not address)
if not test_utils.call_until_true(
is_floating_ip_detached_from_server,
CONF.compute.build_timeout,
CONF.compute.build_interval):
msg = ("Floating IP '%s' should not be in server addresses: %s" %
(floating_ip['ip'], server['addresses']))
raise exceptions.TimeoutException(msg)