From 9429b39512a221da3e61965ec193b9ccbc31c4c4 Mon Sep 17 00:00:00 2001 From: John Schwarz Date: Thu, 1 Dec 2016 11:49:14 +0200 Subject: [PATCH] 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 59bb1ecfb036abf0013d38b39324bf7bcde3b983) --- neutron/tests/functional/agent/l3/framework.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/neutron/tests/functional/agent/l3/framework.py b/neutron/tests/functional/agent/l3/framework.py index b8726d3f105..41f1450bbe6 100644 --- a/neutron/tests/functional/agent/l3/framework.py +++ b/neutron/tests/functional/agent/l3/framework.py @@ -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):