From c310b8d6346c7a0d1a10d4f81d6ce64db9ddf460 Mon Sep 17 00:00:00 2001 From: zhufl Date: Tue, 27 Sep 2016 11:33:23 +0800 Subject: [PATCH] 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 --- tempest/scenario/test_minimum_basic.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py index 34a65cb4d3..3ac6759787 100644 --- a/tempest/scenario/test_minimum_basic.py +++ b/tempest/scenario/test_minimum_basic.py @@ -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'] - 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['ip'], server['addresses'])) + + 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_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)