Functional tests: change assert to wait_until_true

In certain cases, the keepalived can take a few seconds to run/stop.
For this reason, the patch proposes a change to the tests, in which
instead of asserting that the process started/stopped, we'll wait a
short while until they do. This will cause failing tests to not fail
simply because it took a few extra CPU cycles to run.

Change-Id: I497ef32651fbb68bf49e172543f9675f6279df4b
(cherry picked from commit 59bb1ecfb0)
This commit is contained in:
John Schwarz 2016-12-01 11:49:14 +02:00 committed by venkata anil
parent 92689470e1
commit 9429b39512
1 changed files with 6 additions and 2 deletions

View File

@ -302,14 +302,18 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
if enable_ha:
self._assert_ha_device(router)
self.assertTrue(router.keepalived_manager.get_process().active)
common_utils.wait_until_true(
lambda: router.keepalived_manager.get_process().active,
timeout=15)
self._delete_router(self.agent, router.router_id)
self._assert_interfaces_deleted_from_ovs()
self._assert_router_does_not_exist(router)
if enable_ha:
self.assertFalse(router.keepalived_manager.get_process().active)
common_utils.wait_until_true(
lambda: not router.keepalived_manager.get_process().active,
timeout=15)
return return_copy
def manage_router(self, agent, router):