Merge "Copy test result files to zull logs dir"

changes/26/683126/36
Zuul 3 years ago committed by Gerrit Code Review
commit e80d4654de
  1. 9
      playbooks/infrared/post.yaml
  2. 12
      playbooks/infrared/pre.yaml
  3. 4
      roles/plugin.spec
  4. 3
      roles/tobiko-collect/defaults/main.yaml
  5. 21
      roles/tobiko-collect/tasks/main.yaml
  6. 20
      roles/tobiko-common/defaults/main.yaml
  7. 9
      zuul.d/infrared.yaml

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

@ -2,6 +2,12 @@
- hosts: all
tasks:
- debug:
msg: |
TODO(fressi): prepare here host before executing tox -e infrared
- 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 }}'

@ -116,7 +116,3 @@ subparsers:
type: Value
help: local directory where report files are going to be copied to
ansible_variable: test_collect_dir
compress-collected:
type: Flag
help: compress report files before collecting them
ansible_variable: compress_collected_files

@ -5,6 +5,3 @@ report_dir: '{{ test_report_dir | realpath }}'
report_files: '{{ test_report_files }}'
report_name: '{{ test_report_name }}'
collect_dir: '{{ test_collect_dir | realpath }}'
compress_collected_files: no
report_files_suffix: '{% if (compress_collected_files | bool) %}.gz{% endif %}'

@ -4,7 +4,7 @@
file:
path: '{{ collect_dir }}'
state: directory
delegate_to: 127.0.0.1
delegate_to: localhost
- name: "look for report files in {{ report_dir }}"
@ -32,24 +32,19 @@
loop: '{{ report_files }}'
- name: "filter out non existing files"
- name: "filter out non existing report files"
set_fact:
report_files: '{{ stat_report_files.results | json_query("[?stat.exists].stat.path") }}'
- name: "compress report files"
when: compress_collected_files | bool
archive:
path: '{{ item }}'
loop: '{{ report_files }}'
report_files: >
{{ stat_report_files.results |
json_query("[?stat.exists].stat.path") }}
- name: "collect report files to local directory '{{ collect_dir }}'"
synchronize:
dest: '{{ collect_dir }}'
dest: '{{ collect_dir }}/{{ item | basename }}'
mode: pull
src: "{{ item }}{{ report_files_suffix }}"
src: '{{ item }}'
use_ssh_args: yes
recursive: yes
loop: '{{ report_files }}'
ignore_errors: yes
loop: '{{ report_files }}'

@ -2,7 +2,7 @@
# --- Tobiko deploy options ---------------------------------------------------
user_home: '{{ ansible_env.get("HOME", "~")}}'
user_home: '{{ ansible_env.get("HOME", "~") }}'
tobiko_dir: '{{ user_home }}/src/tobiko'
tobiko_src_dir: '{{ role_path | dirname | dirname }}'
@ -13,9 +13,9 @@ tobiko_git_version: ''
# --- Test deploy options -----------------------------------------------------
test_dir: '{{ tobiko_dir }}'
test_src_dir: '{{ tobiko_src_dir }}'
test_git_repo: '{{ tobiko_git_repo }}'
test_dir: '{{ tobiko_dir | realpath }}'
test_src_dir: '{{ tobiko_src_dir | realpath }}'
test_git_repo: '{{ tobiko_git_repo | realpath }}'
test_git_refspec: ''
test_git_version: ''
@ -23,7 +23,7 @@ test_git_version: ''
# --- Test configuration options ----------------------------------------------
# Configuration options
test_conf_file: '{{ test_dir }}/tobiko.conf'
test_conf_file: '{{ test_dir | realpath }}/tobiko.conf'
test_conf: {}
@ -33,16 +33,16 @@ test_log_debug: true
# --- Test report options -----------------------------------------------------
# Remote directory where test cases shoulw write report files to
test_report_dir: "{{ test_dir }}"
test_report_dir: "{{ test_dir | realpath }}"
test_report_files:
- '{{ test_conf_file }}'
- '{{ test_log_file }}'
- '{{ test_conf_file | realpath }}'
- '{{ test_log_file | realpath }}'
# Test report files prefix
test_report_name: test_results
# Log file where test cases should write logging messages to
test_log_file: "{{ test_report_dir }}/tobiko.log"
test_log_file: '{{ test_report_dir | realpath }}/tobiko.log'
# Local where test cases results are being collected to
test_collect_dir: "{{ test_src_dir }}/{{ test_report_name }}"
test_collect_dir: '{{ test_src_dir | realpath }}/{{ test_report_name }}'

@ -2,16 +2,19 @@
- job:
name: tobiko-tox-infrared-py36
parent: openstack-tox
parent: openstack-tox-py36
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
bindep_profile: test
python_version: 3.6
tox_extra_args: >
-- --collect-dir '{{ test_results_dir }}'
pre-run: playbooks/infrared/pre.yaml
post-run: playbooks/infrared/post.yaml
- job:

Loading…
Cancel
Save