summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2023-04-26 12:22:36 +0000
committerGerrit Code Review <review@openstack.org>2023-04-26 12:22:36 +0000
commit5cd0388eb7cac84fc1aaa425184bf4af67ed0608 (patch)
treef0a2cde4d0b83f572685fcd8e2730c612027ce96
parentd8eb64e1cf0d3d6cacbe5f09d4270e9d9814e87e (diff)
parent43829301f3ea280913932af9c7eb7cbc42fde8c5 (diff)
downloadneutron-5cd0388eb7cac84fc1aaa425184bf4af67ed0608.tar.gz
Merge "Handle "no such process" during keepalived process cleanup"
-rw-r--r--neutron/tests/functional/agent/linux/test_keepalived.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/neutron/tests/functional/agent/linux/test_keepalived.py b/neutron/tests/functional/agent/linux/test_keepalived.py
index aa36cd250f..699dc25213 100644
--- a/neutron/tests/functional/agent/linux/test_keepalived.py
+++ b/neutron/tests/functional/agent/linux/test_keepalived.py
@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import signal
from oslo_config import cfg
@@ -27,6 +26,7 @@ from neutron.tests.common import net_helpers
from neutron.tests.functional.agent.linux import helpers
from neutron.tests.functional import base
from neutron.tests.unit.agent.linux import test_keepalived
+from neutron_lib.exceptions import ProcessExecutionError
class KeepalivedManagerTestCase(base.BaseSudoTestCase,
@@ -51,12 +51,17 @@ class KeepalivedManagerTestCase(base.BaseSudoTestCase,
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)
+ self.manager.disable()
+ except ProcessExecutionError as process_err:
+ # self.manager.disable() will perform SIGTERM->wait->SIGKILL
+ # (if needed) on the process. However, it is sometimes possible
+ # that SIGKILL gets called on a process that just exited due to
+ # SIGTERM. Ignore this condition so the test is not marked as
+ # failed.
+ if not (len(process_err.args) > 0 and
+ "No such process" in process_err.args[0]):
+ raise
def _prepare_devices(self):
# NOTE(slaweq): those are devices used in keepalived config file,