From 3c156b6a4a8f265eb6bd1aa764e49fd4bf1b297d Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Fri, 13 Dec 2019 15:33:15 +0000 Subject: [PATCH] Check "keepalived" is stopped in KeepalivedManagerTestCase During the test case teardown process, the clean up methods should check that the "keepalived" process spawned is actually stopped. If not, the process should be killed (SIGKILL instead of SIGTERM, sent in "KeepalivedManager.disable()") TrivalFix Change-Id: Ifeae4593f56b40de81f234c557349563c1cd6f8c --- .../tests/functional/agent/linux/test_keepalived.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/neutron/tests/functional/agent/linux/test_keepalived.py b/neutron/tests/functional/agent/linux/test_keepalived.py index 4f96a1c47ee..cd60200b93d 100644 --- a/neutron/tests/functional/agent/linux/test_keepalived.py +++ b/neutron/tests/functional/agent/linux/test_keepalived.py @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +import signal + from oslo_config import cfg from neutron._i18n import _ @@ -44,7 +46,15 @@ class KeepalivedManagerTestCase(base.BaseSudoTestCase, 'router1', self.expected_config, self.process_monitor, conf_path=cfg.CONF.state_path, namespace=self.namespace) - self.addCleanup(self.manager.disable) + self.addCleanup(self._stop_keepalived_manager) + + def _stop_keepalived_manager(self): + self.manager.disable() + try: + common_utils.wait_until_true( + lambda: not self.manager.get_process().active, timeout=5) + except common_utils.WaitTimeout: + self.manager.get_process().disable(sig=signal.SIGKILL) def _prepare_devices(self): # NOTE(slaweq): those are devices used in keepalived config file,