From 8a08cb94ac76b2087d7ca5c4dfa46aa7162994d0 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 22 Jul 2020 12:40:09 -0700 Subject: [PATCH] Collect partial subunit files If (s)testr are killed during a test run (possibly due to a timeout) they will "leak" a tmp file containing the subunit stream to that point. This file is useful for debugging so collect it. We don't process it further as the file is a partial stream and humans may need to look at it to make sense of it. Change-Id: I6f0e61ec78f4dd9e2c4e52bc968b4f57586cb22e --- roles/fetch-subunit-output/tasks/main.yaml | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/roles/fetch-subunit-output/tasks/main.yaml b/roles/fetch-subunit-output/tasks/main.yaml index 3af6e1af2..afe25b39d 100644 --- a/roles/fetch-subunit-output/tasks/main.yaml +++ b/roles/fetch-subunit-output/tasks/main.yaml @@ -43,5 +43,31 @@ state: absent failed_when: false + # If (s)testr was stopped early (possibly due to a timeout) it will "leak" + # a tmp file of the inflight subunit stream. Collect this as it is useful + # for debugging in these situations. Because it isn't a complete file + # we don't process it further. + - name: Find any inflight partial subunit files + find: + paths: + - "{{ zj_item }}/.testrepository" + - "{{ zj_item }}/.stestr" + patterns: + - 'tmp*' + register: partial_subunit_files + loop: "{{ all_subunit_dirs }}" + loop_control: + loop_var: zj_item + + - name: Copy any inflight subunit files + copy: + dest: "{{ zuul_output_dir }}/logs/" + src: "{{ zj_item.path }}" + remote_src: true + with_items: "{{ partial_subunit_files.files }}" + loop_control: + loop_var: zj_item + when: partial_subunit_files.files is defined + - name: Process and fetch subunit results include_tasks: process.yaml