From 578e65a8d4ade7e9d814811f0fa959893daa0875 Mon Sep 17 00:00:00 2001 From: Roman Safronov Date: Sun, 21 Apr 2024 11:30:09 +0300 Subject: [PATCH] Filter neutron pod more accurately In case an inveronment has ironic-neutron pod or some neutron pod with statuses different than Running some tests may fail. This patch makes filtering of neutron pod more strict in order to ensure only a relevant pod is returned. Change-Id: I7bd3ab6d0e3a89bf07cd91ff559110151bad4ae2 --- whitebox_neutron_tempest_plugin/tests/scenario/base.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/whitebox_neutron_tempest_plugin/tests/scenario/base.py b/whitebox_neutron_tempest_plugin/tests/scenario/base.py index 66825c1..cb43d11 100644 --- a/whitebox_neutron_tempest_plugin/tests/scenario/base.py +++ b/whitebox_neutron_tempest_plugin/tests/scenario/base.py @@ -304,11 +304,12 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase): @classmethod def get_pod_of_service(cls, service='neutron'): - pods_list = "{} get pods".format(cls.OC) + pods_list = ("{} get pods -o=name " + "--field-selector=status.phase=Running".format(cls.OC)) if service == 'neutron': - filters = "grep neutron | grep -v meta | cut -d' ' -f1" + filters = "cut -d'/' -f 2 | grep ^neutron | grep -v meta" else: - filters = "grep {} | cut -d' ' -f1".format(service) + filters = "cut -d'/' -f 2 | grep {}".format(service) return cls.proxy_host_client.exec_command( "{} | {}".format(pods_list, filters)).strip()