Fix remove_log_lines_end_json_str function

This function did not work properly when last line from the json file
ends with "<some-text>}".
It only worked when the last line was only "}".

Related-Jira: #TOBIKO-141
Change-Id: I9e959e2f28f6963fc568581576b827293ba884aa
This commit is contained in:
Eduardo Olivares 2025-04-02 14:59:43 +02:00
parent 24c588e948
commit 97e86f3917
2 changed files with 2 additions and 3 deletions

View File

@ -211,8 +211,6 @@ class PodifiedTopology(rhosp.RhospTopology):
'check_function': iperf3.check_iperf3_client_results
}
if not ssh_client:
LOG.debug("Running iperf3 client in the POD is "
"implemented yet.")
kwargs['start_function'] = _openshift.start_iperf3
kwargs['liveness_function'] = _openshift.iperf3_pod_alive
kwargs['stop_function'] = _openshift.stop_iperf3_client

View File

@ -246,7 +246,8 @@ def check_iperf3_client_results(address: typing.Union[str, netaddr.IPAddress],
def remove_log_lines_end_json_str(json_str: str) -> str:
lines = json_str.splitlines()
while lines:
if lines[-1].strip() == "}":
last_line = lines[-1].strip()
if len(last_line) > 0 and last_line[-1] == "}":
# Stop when we find }
break
# Remove last line, remove possible error logs