From 7e40299d893902ea63b45aedc16ab9c1e367ff01 Mon Sep 17 00:00:00 2001 From: Alexander Kurenyshev Date: Thu, 3 Nov 2016 17:53:08 +0300 Subject: [PATCH] Fix baremetal test report Add a fix for failed baremetal jobs because such jobs use a pre-setup job and when it fails there is no test group in the console output which could be parsed via TEST_GROUP_PATTERN Change-Id: I98a2da4e97008c5262c4c2f5472e294b70ce326e --- .../testrail/upload_cases_description.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/fuelweb_test/testrail/upload_cases_description.py b/fuelweb_test/testrail/upload_cases_description.py index e36390410..3ba1cac48 100644 --- a/fuelweb_test/testrail/upload_cases_description.py +++ b/fuelweb_test/testrail/upload_cases_description.py @@ -175,9 +175,20 @@ def get_tests_groups_from_jenkins(runner_name, build_number, distros): groups = re.findall(TEST_GROUP_PATTERN, console) if not groups: - logger.error("No test group found in console of the job {0}/{1}" - .format(b['jobName'], b['buildNumber'])) - continue + # maybe it's failed baremetal job? + # because of a design baremetal tests run pre-setup job + # and when it fails there are no test groups in common meaning: + # groups which could be parsed by TEST_GROUP_PATTERN + baremetal_pattern = re.compile(r'Jenkins Build.*jenkins-(.*)-\d+') + baremetal_groups = re.findall(baremetal_pattern, console) + if not baremetal_groups: + logger.error( + "No test group found in console of the job {0}/{1}".format + (b['jobName'], b['buildNumber'])) + continue + # we should get the group via jobName because the test group name + # inside the log could be cut and some symbols will be changed to * + groups = b['jobName'].split('.') # Use the last group (there can be several groups in upgrade jobs) test_group = groups[-1]