diff --git a/src/report/__main__.py b/src/report/__main__.py index 8f733a0..56a1771 100644 --- a/src/report/__main__.py +++ b/src/report/__main__.py @@ -124,9 +124,10 @@ def parse_request_xunit(request_url_list=None, tasks_source=None, skip_pass=Fals request_state = request.json()["state"].upper() request_uuid = request.json()["id"] request_target = request.json()["environments_requested"][0]["os"]["compose"] - request_arch = request.json()["environments_requested"][0]['arch'] + request_arch = request.json()["environments_requested"][0]["arch"] request_datetime_created = request.json()["created"] request_datetime_parsed = request_datetime_created.split(".")[0] + request_summary = request.json()["result"]["summary"] log_dir = f"{request_uuid}_logs" @@ -175,7 +176,7 @@ def parse_request_xunit(request_url_list=None, tasks_source=None, skip_pass=Fals if request.json()["state"] == "error": error_formatted = FormatText.bg_red + "ERROR" + FormatText.bg_default - error_reason = request.json()["result"]["summary"] + error_reason = request_summary message = ( f"Request ended up in {error_formatted} state, because {error_reason}.\n" f"See more details on the result page {url.replace(TESTING_FARM_ENDPOINT, ARTIFACT_BASE_URL)}" @@ -200,12 +201,30 @@ def parse_request_xunit(request_url_list=None, tasks_source=None, skip_pass=Fals job_result_overall = xml.xpath("/testsuites/@overall-result")[0] job_test_suite = xml.xpath("//testsuite") + + # If there is just a single test suite returned and the name of the test suite + # is pipeline, we can assume that the response contains only information about the pipeline. + # Set the potential_pipeline_error to True and hand over to the overall job result evaluation + potential_pipeline_error = False + if ( + len(job_test_suite) == 1 + and job_test_suite[0].xpath("./@name")[0] == "pipeline" + ): + potential_pipeline_error = True + if job_result_overall == "passed": update_retval(ALL_PASS) elif job_result_overall == "failed": update_retval(FAIL_HERE) elif job_result_overall == "error": update_retval(ERROR_HERE) + # Bail out, when the potential pipeline error assessment returns True + if potential_pipeline_error: + LOGGER.critical( + f"Potential pipeline ERROR, please verify the accuracy of the assessment at {url}" + ) + LOGGER.critical(f"Result summary: {request_summary}") + continue else: update_retval(99) @@ -231,7 +250,9 @@ def parse_request_xunit(request_url_list=None, tasks_source=None, skip_pass=Fals # it consist of only the plan name testsuite_name = elem.xpath("./@name")[0].split(":")[-1] try: - testsuite_arch = elem.xpath("./testing-environment/property[@name='arch']/@value")[0] + testsuite_arch = elem.xpath( + "./testing-environment/property[@name='arch']/@value" + )[0] except IndexError: testsuite_arch = elem.xpath("./@name")[0].split(":")[1] testsuite_result = elem.xpath("./@result")[0].upper() @@ -433,7 +454,6 @@ def build_table(): if ARGS.split_planname: planname_split_index = ARGS.split_planname - def _gen_row(uuid="", target="", arch="", testplan="", testcase="", result=""): if "UUID" in fields: yield uuid