Ignore exit code 1 when returned stdout is correct

When the `ps` command is executed on a pod with `oc rsh <pod> ps ...`,
sometimes the exit code is not 0, but the command returns the expected
output.
This patch adds " || true" to that command in order to ignore the
returned code.

Related-issue: OSPRH-8352
Related-issue: https://github.com/kubevirt/kubevirt/issues/10240

Change-Id: I246adf9f10a2d08b64be001bf13bfb807fb62698
This commit is contained in:
Eduardo Olivares 2024-07-10 12:34:53 +02:00
parent 30af407669
commit e219a1fa23

View File

@ -1237,11 +1237,17 @@ class BaseTempestTestCaseOvn(BaseTempestWhiteboxTestCase):
command_items.append('--db="{}"'.format(all_db_addresses))
# obtain the ovsdb-server command running on this pod
# `|| true` added to prevent the following issue:
# https://github.com/kubevirt/kubevirt/issues/10240
cmd = ' '.join((cls.OC,
'rsh',
db_pod,
'ps -o command -C ovsdb-server --no-headers -ww'))
'ps -o command -C ovsdb-server --no-headers -ww',
'|| true'))
ovsdb_server_cmd = cls.proxy_host_client.exec_command(cmd)
assert 'ovsdb-server' in ovsdb_server_cmd, \
"command '{}' returned unexpected output: {}".format(
cmd, ovsdb_server_cmd)
# obtain the private-key, certificate and ca-cert options
for ssl_param in ('private-key', 'certificate', 'ca-cert'):
command_items.append(re.search(