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
import eventlet
from neutron.agent.linux import async_process
+from neutron.agent.linux import utils
from neutron.tests import base
# 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)