From 99d1d5dabdf7cb7719ad6875fbb3d18dd18c3448 Mon Sep 17 00:00:00 2001 From: pkomarov Date: Fri, 20 Sep 2019 00:53:20 +0300 Subject: [PATCH] add report collection for downstream jobs Change-Id: I37511912c3cbde427fd8d41ea9caddd9e0a2cb22 --- infrared/main.yml | 3 +++ infrared/tasks/report.yml | 14 ++++++++++++++ infrared/tasks/templates/tobiko.conf.j2 | 2 +- plugin.spec | 6 ++++++ report/build.sh | 4 ++-- 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 infrared/tasks/report.yml diff --git a/infrared/main.yml b/infrared/main.yml index 971e4cebf..4a95ac44c 100644 --- a/infrared/main.yml +++ b/infrared/main.yml @@ -14,3 +14,6 @@ include_tasks: tasks/run.yml when: - test.tests is defined + + - name: Collect Tobiko logs and reports + include_tasks: tasks/report.yml diff --git a/infrared/tasks/report.yml b/infrared/tasks/report.yml new file mode 100644 index 000000000..81861d15c --- /dev/null +++ b/infrared/tasks/report.yml @@ -0,0 +1,14 @@ + - name: Create Tobiko report + shell: | + cd "{{ test.dir }}" + source "{{ test.venv }}/bin/activate" + tox -e report + + - fetch: + src: "{{ test.dir }}/{{ item }}" + dest: "{{ inventory_dir }}/tobiko_results_{{ test.results_dir_suffix }}/" + flat: yes + loop: + - tobiko.conf + - tobiko.log + - tobiko_results.html \ No newline at end of file diff --git a/infrared/tasks/templates/tobiko.conf.j2 b/infrared/tasks/templates/tobiko.conf.j2 index ef7b32818..6c674fc80 100644 --- a/infrared/tasks/templates/tobiko.conf.j2 +++ b/infrared/tasks/templates/tobiko.conf.j2 @@ -1,6 +1,6 @@ [DEFAULT] debug = true -log_file = tobiko.log +log_file = "{{ test.dir }}/tobiko.log" log_dir = . [nova] diff --git a/plugin.spec b/plugin.spec index 7a6001365..3dec7a095 100644 --- a/plugin.spec +++ b/plugin.spec @@ -41,6 +41,12 @@ subparsers: help: | The set of tests to execute default: neutron + results_dir_suffix: + type: Value + help: | + Suffix string to add to tobiko_results dir + example : default will be tobiko_results_1st + default: "1st" refsec: type: Value help: | diff --git a/report/build.sh b/report/build.sh index 7919c2512..bf6343bb2 100755 --- a/report/build.sh +++ b/report/build.sh @@ -6,9 +6,9 @@ set -xeu TESTR_DIR=${TESTR_DIR:-$(pwd)} -BUILD_DIR=${BUILD_DIR:-${TESTR_DIR}/report/build} +BUILD_DIR=${BUILD_DIR:-${TESTR_DIR}} SUBUNIT_FILE=${SUBUNIT_FILE:-${BUILD_DIR}/last.subunit} -TESTR_RESULTS_HTML=${TESTR_RESULTS_HTML:-${BUILD_DIR}/testr_results.html} +TESTR_RESULTS_HTML=${TESTR_RESULTS_HTML:-${BUILD_DIR}/tobiko_results.html} make_testr_results_html() { mkdir -p "$(dirname ${SUBUNIT_FILE})"