Verify infrared plugin actually collect output files

Change-Id: Ib4f8961f50bd3ed68e472eb0fb6be67e27f156f3
This commit is contained in:
Federico Ressi 2020-04-01 14:34:38 +02:00
parent 5adb45c29b
commit 0d9e88a6fe
7 changed files with 91 additions and 52 deletions

View File

@ -1,9 +0,0 @@
---
- hosts: all
tasks:
- name: "list test results files at '{{ test_results_dir }}'"
command:
cmd: 'ls -lh'
chdir: '{{ test_results_dir }}'

View File

@ -1,13 +0,0 @@
---
- hosts: all
tasks:
- name: "ensure test results directory is writable by user '{{ ansible_user }}'"
file:
path: '{{ item }}'
state: directory
owner: '{{ ansible_user }}'
mode: '0755'
become: yes
loop:
- '{{ test_results_dir }}'

View File

@ -0,0 +1,74 @@
---
- hosts: all
vars:
zuul_output_dir: '{{ ansible_user_dir }}/zuul-output'
zuul_work_dir: '{{ zuul.project.src_dir }}'
test_collect_dir: '{{ zuul_output_dir }}/logs'
roles:
- tobiko-common
- tobiko-ensure-bindep
- tobiko-ensure-tox
tasks:
- debug: var=unversioned_python_info
- debug: var=python_info
- block:
- name: "get missing binary dependencies"
command:
cmd: >
{{ bindep_executable | quote }} -b -f bindep.txt
chdir: '{{ zuul_work_dir }}'
register: get_missing_deps
rescue:
- name: "install missing dependencies"
become: yes
package:
name: '{{ get_missing_deps.stdout_lines }}'
- name: "run Tox InfraRed plugin"
command:
cmd: >
{{ tox_executable | quote }} -e infrared --
--collect-dir {{ test_collect_dir | quote }}
chdir: '{{ zuul_work_dir }}'
environment:
PYTHON: '{{ unversioned_python_executable }}'
ANSIBLE_PYTHON_INTERPRETER: '{{ unversioned_python_executable }}'
ignore_errors: yes
register: run_tox
- name: "show Tox output"
debug: var=run_tox.stdout_lines
- name: "show Tox errors"
debug: var=run_tox.stderr_lines
when: run_tox is failed
failed_when: yes
- name: "list collected files"
command: >
ls '{{ test_collect_dir }}'
register: list_test_result_files
- name: "set collected files fact"
set_fact:
collected_files: '{{ list_test_result_files.stdout_lines }}'
- name: "show collected files"
debug: var=collected_files
- name: "check collected files"
assert:
that:
- item in collected_files
loop:
- tobiko.log
- tobiko.conf
- test_results.html
- test_results.subunit
- test_results.xml

View File

@ -17,3 +17,6 @@ tox_report_name: '{{ test_report_name }}{% if tox_envlist %}_{{ tox_envlist }}{%
tox_report_env:
TOBIKO_TEST_REPORT_DIR: '{{ tox_report_dir }}'
TOBIKO_TEST_REPORT_NAME: '{{ tox_report_name }}'
tox_constrain_env:
PYTHON: '{{ tox_python }}'

View File

@ -1,13 +1,5 @@
---
- name: "set 'PYTHON={{ tox_python }}' in Tox environment variables"
set_fact:
tox_environment: >
{{ tox_environment | combine({ "PYTHON": (tox_python or "") }) }}
when:
- tox_python is defined
- name: "show tox environment"
debug: var=tox_environment
@ -23,7 +15,7 @@
cmd: '{{ tox_command_line }}'
register:
run_tox
environment: '{{ tox_environment }}'
environment: '{{ tox_environment | combine(tox_constrain_env) }}'
ignore_errors: yes
@ -40,7 +32,7 @@
{{ tox_command }} -e report
register:
make_report
environment: '{{ tox_report_env }}'
environment: '{{ tox_report_env | combine(tox_constrain_env) }}'
ignore_errors: yes

View File

@ -1,26 +1,18 @@
---
- job:
name: tobiko-tox-infrared-py36
parent: openstack-tox-py36
name: tobiko-tox-infrared
parent: tox
abstract: true
timeout: 1800
description: |
Run test cases using tobiko infrared plugin
vars:
zuul_output_dir: '{{ ansible_user_dir }}/zuul-output'
test_results_dir: '{{ zuul_output_dir }}/logs'
tox_envlist: infrared
tox_extra_args: >
--
--collect-dir '{{ test_results_dir }}'
pre-run: playbooks/infrared/pre.yaml
post-run: playbooks/infrared/post.yaml
run: playbooks/infrared/run.yaml
- job:
name: tobiko-tox-infrared-py36-centos-7
parent: tobiko-tox-infrared-py36
name: tobiko-tox-infrared-centos-7
parent: tobiko-tox-infrared
nodeset: centos-7
voting: false
description: |
@ -28,8 +20,8 @@
- job:
name: tobiko-tox-infrared-py36-centos-8
parent: tobiko-tox-infrared-py36
name: tobiko-tox-infrared-centos-8
parent: tobiko-tox-infrared
nodeset: centos-8
voting: false
description: |
@ -37,8 +29,8 @@
- job:
name: tobiko-tox-infrared-py36-ubuntu-bionic
parent: tobiko-tox-infrared-py36
name: tobiko-tox-infrared-ubuntu-bionic
parent: tobiko-tox-infrared
nodeset: ubuntu-bionic
voting: false
description: |

View File

@ -20,9 +20,9 @@
- tobiko-devstack-functional
- tobiko-devstack-faults-centos-7
- tobiko-devstack-faults-ubuntu-bionic
- tobiko-tox-infrared-py36-centos-7
- tobiko-tox-infrared-py36-centos-8
- tobiko-tox-infrared-py36-ubuntu-bionic
- tobiko-tox-infrared-centos-7
- tobiko-tox-infrared-centos-8
- tobiko-tox-infrared-ubuntu-bionic
- tobiko-tripleo-functional
- tobiko-tripleo-faults