bbca430417
Stop compressing files that would otherwise be handled uncompressed in intermediate log handling. The reason for this is final log/artifact upload should decide if a file need to be compressed or not as some file hosting services (like swift) may not return the expected data if we get this wrong. This was noticed when we used swift to store intermediate tar.gz tarballs before final upload to permanent storage. When retrieving the tar.gz files from swift we got them back as uncompressed .tar files (because swift was being helpful) and then later when we try to uncompress these files we break. Instead we'll let the upload to swift (or other storage) decide if files should be compressed further than their existing state. This is the first change in the stack that updates this behavior for fetch-subunit-output. Change-Id: I5727b270d6d34c256fe78a443baa1ad6c3474108
128 lines
4.2 KiB
YAML
128 lines
4.2 KiB
YAML
- name: Run the fetch-subunit-output role
|
|
hosts: all
|
|
vars:
|
|
tests_data:
|
|
main:
|
|
directory: "{{ zuul_work_dir }}"
|
|
test_pattern: "WorkingTest.test_success"
|
|
secondary:
|
|
directory: "/var/tmp/extratests"
|
|
test_pattern: "FailingTest.test_failure"
|
|
pre_tasks:
|
|
# Required packages; install them into a .tox path
|
|
# to cover the find-*.sh scripts in the role a bit more.
|
|
- name: Install stestr and subunit-output
|
|
pip:
|
|
name:
|
|
- stestr>=2.0.0,<2.6.0
|
|
- python-subunit
|
|
virtualenv: "{{ zuul_work_dir }}/.tox/utests/"
|
|
|
|
- name: Ensure that the test directories exists
|
|
file:
|
|
name: "{{ item.value.directory }}"
|
|
state: directory
|
|
loop: "{{ tests_data|dict2items }}"
|
|
|
|
- name: Copy the test files on all directories
|
|
copy:
|
|
src: "subunit_tests"
|
|
dest: "{{ item.value.directory }}"
|
|
loop: "{{ tests_data|dict2items }}"
|
|
|
|
- name: Prepare the test results on all directories
|
|
shell: |
|
|
. {{ zuul_work_dir }}/.tox/utests/bin/activate
|
|
stestr init
|
|
stestr run --test-path subunit_tests {{ item.value.test_pattern }}
|
|
args:
|
|
chdir: "{{ item.value.directory }}"
|
|
ignore_errors: yes
|
|
loop: "{{ tests_data|dict2items }}"
|
|
roles:
|
|
- role: fetch-subunit-output
|
|
post_tasks:
|
|
- name: Check that the testrepository file has been pulled
|
|
delegate_to: localhost
|
|
file:
|
|
path: "{{ zuul.executor.log_root }}/testrepository.subunit"
|
|
state: file
|
|
register: local_subunit_file
|
|
|
|
- name: Check that HTML test result file has been pulled
|
|
delegate_to: localhost
|
|
file:
|
|
path: "{{ zuul.executor.log_root }}/testr_results.html"
|
|
state: file
|
|
register: local_html_test_results
|
|
|
|
- name: Validate that files were pulled correctly
|
|
assert:
|
|
that:
|
|
- local_subunit_file is not changed
|
|
- local_subunit_file is succeeded
|
|
- local_html_test_results is not changed
|
|
- local_html_test_results is succeeded
|
|
|
|
# only one subunit file; the failed result should be hidden
|
|
- name: Check the content of the HTML file
|
|
delegate_to: localhost
|
|
shell: |
|
|
GLOBAL_RESULT=1
|
|
zgrep -q -E 'subunit_tests.test_working.WorkingTest.test_success$' \
|
|
{{ zuul.executor.log_root }}/testr_results.html
|
|
T1=$?
|
|
zgrep -q -E 'subunit_tests.test_failing.FailingTest.test_failure.*_StringException:' \
|
|
{{ zuul.executor.log_root }}/testr_results.html
|
|
T2=$?
|
|
if [ ${T1} -eq 0 ] && [ ${T2} -ne 0 ]; then
|
|
GLOBAL_RESULT=0
|
|
fi
|
|
exit $GLOBAL_RESULT
|
|
|
|
|
|
# The following test(s) require(s) the previous playbook
|
|
- name: Run the fetch-subunit-output role with multiple subunits
|
|
hosts: all
|
|
roles:
|
|
- role: fetch-subunit-output
|
|
fetch_subunit_output_additional_dirs:
|
|
- "/var/tmp/extratests"
|
|
post_tasks:
|
|
- name: Check that the testrepository file has been pulled
|
|
delegate_to: localhost
|
|
file:
|
|
path: "{{ zuul.executor.log_root }}/testrepository.subunit"
|
|
state: file
|
|
register: local_subunit_file
|
|
|
|
- name: Check that HTML test result file has been pulled
|
|
delegate_to: localhost
|
|
file:
|
|
path: "{{ zuul.executor.log_root }}/testr_results.html"
|
|
state: file
|
|
register: local_html_test_results
|
|
|
|
- name: Validate that files were pulled correctly
|
|
assert:
|
|
that:
|
|
- local_subunit_file is not changed
|
|
- local_subunit_file is succeeded
|
|
- local_html_test_results is not changed
|
|
- local_html_test_results is succeeded
|
|
|
|
- name: Check the content of the HTML file
|
|
delegate_to: localhost
|
|
shell: |
|
|
GLOBAL_RESULT=1
|
|
zgrep -q -E 'subunit_tests.test_working.WorkingTest.test_success$' \
|
|
{{ zuul.executor.log_root }}/testr_results.html
|
|
T1=$?
|
|
zgrep -q -E 'subunit_tests.test_failing.FailingTest.test_failure.*_StringException:' \
|
|
{{ zuul.executor.log_root }}/testr_results.html
|
|
T2=$?
|
|
if [ ${T1} -eq 0 ] && [ ${T2} -eq 0 ]; then
|
|
GLOBAL_RESULT=0
|
|
fi
|
|
exit $GLOBAL_RESULT
|