From ba45f251d137f0c31ce97b8ef523612ccfd5d9ac Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 13 Jul 2020 14:27:58 +1000 Subject: [PATCH] Fix junit error, add HTML report Specifying the family stops a deprecation warning being output. Add a HTML report and report it as an artifact as well; this is easier to read. Change-Id: I2bd6505c19cee2d51e9af27e9344cfe2e1110572 --- playbooks/zuul/run-base.yaml | 30 ++++++++++++++++++++---------- test-requirements.txt | 1 + tox.ini | 6 +++++- zuul.d/system-config-run.yaml | 1 + 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/playbooks/zuul/run-base.yaml b/playbooks/zuul/run-base.yaml index 40f0c3f381..44e7f51cd6 100644 --- a/playbooks/zuul/run-base.yaml +++ b/playbooks/zuul/run-base.yaml @@ -107,13 +107,23 @@ content: "{{ testinfra_extra_data | default('') | to_nice_yaml(indent=2) }}" dest: '/home/zuul/testinfra_extra_data_fixture.yaml' - - name: Run testinfra to validate configuration - include_role: - name: tox - vars: - tox_envlist: testinfra - # This allows us to run from external projects (like testinfra - # itself) - tox_environment: - TESTINFRA_EXTRA_DATA: '/home/zuul/testinfra_extra_data_fixture.yaml' - zuul_work_dir: src/opendev.org/opendev/system-config + - name: Run and collect testinfra + block: + - name: Run testinfra to validate configuration + include_role: + name: tox + vars: + tox_envlist: testinfra + # This allows us to run from external projects (like testinfra + # itself) + tox_environment: + TESTINFRA_EXTRA_DATA: '/home/zuul/testinfra_extra_data_fixture.yaml' + zuul_work_dir: src/opendev.org/opendev/system-config + always: + - name: Return testinfra report artifact + zuul_return: + data: + zuul: + artifacts: + - name: testinfra results + url: "bridge.openstack.org/test-results.html" diff --git a/test-requirements.txt b/test-requirements.txt index 5f883f0871..a8d9df17ea 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -12,6 +12,7 @@ mock # testinfra 1.17.0 has a broken wheel that won't install under python3 # testinfra 3.0.0 switched the ansible backend, but broke ipv6 handling testinfra!=1.17.0,!=3.0.0 +pytest-html # MPL-2.0 # testinfra's ansible backend actually requires paramiko, but it's not # specified. After # https://github.com/philpep/testinfra/pull/454 diff --git a/tox.ini b/tox.ini index 7224df16da..27db0cbad1 100644 --- a/tox.ini +++ b/tox.ini @@ -36,7 +36,11 @@ commands = sphinx-build -W -E -b html doc/source doc/build/html # This environment assumes a gate-hosts.yaml file has been written. passenv = TESTINFRA_EXTRA_DATA -commands = py.test --junit-xml junit.xml --connection=ansible --ansible-inventory=/home/zuul/src/opendev.org/opendev/system-config/inventory/base/gate-hosts.yaml -v testinfra {posargs} +commands = py.test \ + --junit-xml junit.xml -o junit_family=xunit1 \ + --html=test-results.html --self-contained-html \ + --connection=ansible \ + --ansible-inventory=/home/zuul/src/opendev.org/opendev/system-config/inventory/base/gate-hosts.yaml -v testinfra {posargs} [flake8] show-source = True diff --git a/zuul.d/system-config-run.yaml b/zuul.d/system-config-run.yaml index 7121fec4fc..68c8a997f3 100644 --- a/zuul.d/system-config-run.yaml +++ b/zuul.d/system-config-run.yaml @@ -22,6 +22,7 @@ bridge.openstack.org: host_copy_output: '{{ zuul.project.src_dir }}/junit.xml': logs + '{{ zuul.project.src_dir }}/test-results.html': logs '{{ zuul.project.src_dir }}/inventory/base/gate-hosts.yaml': logs # Note: the following two jobs implement the variant-based multiple