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
This commit is contained in:
Roman Safronov 2024-04-21 11:30:09 +03:00
parent bae18298a8
commit 578e65a8d4

View File

@ -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()