Merge "Make fullstack test_connectivity tests more forgiving"
This commit is contained in:
commit
6c0841e8e2
|
@ -13,9 +13,12 @@
|
|||
# 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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue