]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Make fullstack test_connectivity tests more forgiving
authorAssaf Muller <amuller@redhat.com>
Fri, 20 Nov 2015 21:42:38 +0000 (16:42 -0500)
committerAssaf Muller <amuller@redhat.com>
Fri, 20 Nov 2015 21:50:31 +0000 (16:50 -0500)
Change assert_ping to block_until_ping.

Closes-Bug: #1518466

Change-Id: I233cb40e701ef462e9d570d9677da1cbcc2c91c8

neutron/tests/common/machine_fixtures.py
neutron/tests/fullstack/test_connectivity.py

index e61ece189b283f775f22906bb65e7fb7c2dc3fec..c812e5e5d85fdfc3274bd4201db252e21bd86460 100644 (file)
 #    under the License.
 #
 
+import functools
+
 import fixtures
 
 from neutron.agent.linux import ip_lib
+from neutron.agent.linux import utils
 from neutron.tests.common import net_helpers
 
 
@@ -48,6 +51,17 @@ class FakeMachineBase(fixtures.Fixture):
         ns_ip_wrapper = ip_lib.IPWrapper(self.namespace)
         return ns_ip_wrapper.netns.execute(*args, **kwargs)
 
+    def ping_predicate(self, dst_ip):
+        try:
+            self.assert_ping(dst_ip)
+        except RuntimeError:
+            return False
+        return True
+
+    def block_until_ping(self, dst_ip):
+        predicate = functools.partial(self.ping_predicate, dst_ip)
+        utils.wait_until_true(predicate)
+
     def assert_ping(self, dst_ip):
         net_helpers.assert_ping(self.namespace, dst_ip)
 
index 9915af571c694447eedffe1189a1f027f3b7836e..57ff43560b4162a6969e4a87d357ff5a87701e46 100644 (file)
@@ -67,4 +67,4 @@ class TestConnectivitySameNetwork(base.BaseFullStackTestCase):
         for vm in vms:
             vm.block_until_boot()
 
-        vms[0].assert_ping(vms[1].ip)
+        vms[0].block_until_ping(vms[1].ip)