From: Jakub Libosvar Date: Mon, 14 Sep 2015 14:54:34 +0000 (+0000) Subject: func: Don't use private method of AsyncProcess X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f4a76a7a26c0902d61f4fe61091e7fe556923592;p=openstack-build%2Fneutron-build.git func: Don't use private method of AsyncProcess In functional test we simulate crash of AsyncProcess by calling _kill_process(). This method is a private method and such usage introduced a race where process was respawned prior to calling wait() of killed process, leading to infinite wait on newly spawned process. This patch adds manual send of kill and then active waiting for process to be respawned, similarly like done with recent keepalived patch [1]. [1] https://review.openstack.org/#/c/222460/7/neutron/tests/functional/agent/linux/test_keepalived.py Closes-Bug: #1477860 Change-Id: I1c91393304d65a0695311416ecc5b64fd549b192 --- diff --git a/neutron/tests/functional/agent/linux/test_async_process.py b/neutron/tests/functional/agent/linux/test_async_process.py index 89c2bec89..a1bb40d91 100644 --- a/neutron/tests/functional/agent/linux/test_async_process.py +++ b/neutron/tests/functional/agent/linux/test_async_process.py @@ -15,6 +15,7 @@ import eventlet from neutron.agent.linux import async_process +from neutron.agent.linux import utils from neutron.tests import base @@ -67,5 +68,11 @@ class TestAsyncProcess(AsyncProcessTestFramework): # Ensure that the same output is read twice self._check_stdout(proc) - proc._kill_process(proc.pid) + pid = proc.pid + utils.execute(['kill', '-9', pid]) + utils.wait_until_true( + lambda: proc.is_active() and pid != proc.pid, + timeout=5, + sleep=0.01, + exception=RuntimeError(_("Async process didn't respawn"))) self._check_stdout(proc)