tests: Don't raise TimeoutError when waiting for ping

Timeout error makes debugging a little bit harder. This exception makes
more sense.

Change-Id: Idd6556710190019d440b94e725a0f17f89e0f082
This commit is contained in:
Jakub Libosvar 2016-09-13 17:13:30 +02:00
parent 499425b85b
commit a17c52f388
1 changed files with 9 additions and 1 deletions

View File

@ -22,6 +22,10 @@ from neutron.common import utils
from neutron.tests.common import net_helpers
class FakeMachineException(Exception):
pass
class FakeMachineBase(fixtures.Fixture):
"""Create a fake machine.
@ -60,7 +64,11 @@ class FakeMachineBase(fixtures.Fixture):
def block_until_ping(self, dst_ip):
predicate = functools.partial(self.ping_predicate, dst_ip)
utils.wait_until_true(predicate)
utils.wait_until_true(
predicate,
exception=FakeMachineException(
"No ICMP reply obtained from IP address %s" % dst_ip)
)
def assert_ping(self, dst_ip):
net_helpers.assert_ping(self.namespace, dst_ip)