[rp-reporter] rewrite get_link_from_description
Related-Prod: PRODX-53429
Change-Id: I7fc150aa1bea7c476dba87932249162003c478f1
diff --git a/rp_reporter/rp_reporter/batch_reporter.py b/rp_reporter/rp_reporter/batch_reporter.py
index 577d63d..4ee723c 100755
--- a/rp_reporter/rp_reporter/batch_reporter.py
+++ b/rp_reporter/rp_reporter/batch_reporter.py
@@ -163,11 +163,8 @@
LOG.info(f"Can't find {describe_file_pattern} in {job_obj} artifactory")
local_describe_file = local_describe_file[0]
else:
- describe_file_url = [
- file_url
- for file_url in job_obj.get_link_from_description()
- if describe_file_pattern in file_url
- ]
+ describe_file_url = job_obj.get_link_from_description(
+ describe_file_pattern)
if not describe_file_url:
LOG.info(f"Can't find {describe_file_pattern} in {job_obj} " f"description")
return
@@ -322,6 +319,7 @@
tags.update(get_tags_from_osdpl(osdpl_file))
rp_client.update_test_item(attributes=tags, item_uuid=launch_id)
description.rockoon_version = tags.get("rockoon_version")
+
case "tempest-runner-k8s":
title = "Tempest"
test_results_files = [
@@ -348,9 +346,6 @@
f"Can't found 'stepler_test_results.xml' in "
f"{child.url} artifacts"
)
- import ipdb
-
- ipdb.set_trace()
image = get_image_from_describe(
job_obj=child,
describe_file_pattern="stepler_pod.describe",
@@ -361,34 +356,35 @@
case "oscore-si-tests-runner-k8s":
title = "SI tests"
- test_results_files = [
- file_url
- for file_url in child.get_link_from_description()
- if "si_test_report.xml" in file_url
- ]
+ if test_results_files := child.get_link_from_description("si_test_report.xml"):
+ test_results_files = test_results_files[0]
if not test_results_files:
LOG.error(f"Can't found 'si_test_report.xml' in {child.url}")
case "oscore-functional-tests-runner":
title = "Rockoon Functional"
- test_results_files = [
- file_url
- for file_url in child.get_link_from_description()
- if "si_test_report.xml" in file_url
- ]
+ if test_results_files := child.get_link_from_description("si_test_report.xml"):
+ test_results_files = test_results_files[0]
+ if not test_results_files:
+ LOG.error(f"Can't found 'si_test_report.xml' in {child.url}")
+
+ case "oscore-perf-analyzer-tests-runner":
+ title = "Performance tests"
+ if test_results_files := child.get_link_from_description("si_test_report.xml"):
+ test_results_files = test_results_files[0]
if not test_results_files:
LOG.error(f"Can't found 'si_test_report.xml' in {child.url}")
case "si-test-check-downtime-statistic":
title = "Downtime tests"
- test_results_files = [
- f"{file_url}/artifacts/test_check_downtime_statistic_result.xml"
- for file_url in child.get_link_from_description()
- ]
- if not test_results_files:
+ if artifactory_url := child.get_link_from_description():
+ artifactory_url = artifactory_url[0]
+ if not artifactory_url:
LOG.error(
f"Can't found 'test_check_downtime_statistic_result.xml' in {child.url}"
)
+ test_results_files = (f"{artifactory_url}/artifacts/"
+ f"test_check_downtime_statistic_result.xml")
case "collect-openstack-kaas-artifacts":
artifactory_url = child.description.split("url: ")[-1]