From bcf0873c3f4d7f380ea852fc4be03584ecff9a67 Mon Sep 17 00:00:00 2001 From: Eduardo Olivares Date: Tue, 16 Aug 2022 11:45:41 +0000 Subject: [PATCH] Revert "Workaround to remove tests without name from xml report files" This reverts commit 95fb5b5c95eecd782965fc3effb18e0576c4c6da. Reason for revert: The real root cause of the problem with xml reports has been fixed at [1]. The "verify resources" test step, which uses several workers in parallel, was wrongly run with maxfail=1 - when a test failed during this test step, other workers stopped the execution of their tests before they finished, generating wrong xml reports. The maxfail=1 option should only be used with faults tests, which are executed sequentially (only one worker). [1] https://review.opendev.org/c/852252 Change-Id: I6b85e0dc0d2e4e31997754524c416869ca450161 --- .../remove_tests_withoutname_fromxmlreport.py | 40 ------------------- roles/tobiko-collect/tasks/main.yaml | 8 ---- 2 files changed, 48 deletions(-) delete mode 100644 roles/tobiko-collect/files/remove_tests_withoutname_fromxmlreport.py diff --git a/roles/tobiko-collect/files/remove_tests_withoutname_fromxmlreport.py b/roles/tobiko-collect/files/remove_tests_withoutname_fromxmlreport.py deleted file mode 100644 index 896dd18fe..000000000 --- a/roles/tobiko-collect/files/remove_tests_withoutname_fromxmlreport.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2022 Red Hat -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -import argparse -from xml.etree import ElementTree - - -def main(): - parser = argparse.ArgumentParser( - description='Remove testcases with no name ' - 'from the provided xml report file') - parser.add_argument('--xmlfile', type=str, required=True, - help='XML report file path') - args = parser.parse_args() - - report_tree = ElementTree.parse(args.xmlfile) - report_root = report_tree.getroot() - testsuite = report_root[0] - new_testsuite = ElementTree.Element('testsuite') - for testcase in testsuite: - if 'name' in testcase.attrib: - new_testsuite.append(testcase) - new_testsuite.attrib = testsuite.attrib - report_root[0] = new_testsuite - report_tree.write( - args.xmlfile, encoding="utf-8", xml_declaration=True) - - -if __name__ == '__main__': - main() diff --git a/roles/tobiko-collect/tasks/main.yaml b/roles/tobiko-collect/tasks/main.yaml index bc26a5810..d0c8a5b3e 100644 --- a/roles/tobiko-collect/tasks/main.yaml +++ b/roles/tobiko-collect/tasks/main.yaml @@ -39,14 +39,6 @@ json_query("[?stat.exists].stat.path") }} -- name: "[workaround] remove test entries with no 'name' from the xml report files" - script: - cmd: "remove_tests_withoutname_fromxmlreport.py --xmlfile {{ item }}" - executable: python3 - when: item is regex('.*\.xml') - loop: '{{ report_files }}' - - - name: "collect report files to local directory '{{ collect_dir }}'" synchronize: dest: '{{ collect_dir }}/{{ item | basename }}'