Fixes for zip tests

This commit is contained in:
esakaiev@redhat.com 2018-02-09 18:05:33 +02:00
parent aa3f4dccc7
commit 5bfd267546

View File

@ -3,28 +3,19 @@
tags: tags:
- classic - classic
vars:
- artifacts: "{{ lookup('env', 'TEST_ARTIFACTS')|default('./artifacts', true) }}"
tasks: tasks:
- name: Define remote_artifacts if it is not already defined - name: Define remote_artifacts if it is not already defined
set_fact: set_fact:
remote_artifacts: /home/${USER}/artifacts artifacts: ${HOME}/artifacts
when: remote_artifacts is not defined when: artifacts is not defined
- name: Copy tests to target
synchronize:
src: "{{ playbook_dir }}/"
dest: /home/${USER}/bin/
ssh_args: "-o UserKnownHostsFile=/dev/null"
- name: Make artifacts directory - name: Make artifacts directory
file: path={{ remote_artifacts }} state=directory recurse=yes file: path={{ artifacts }} state=directory recurse=yes
- block: - block:
- name: Execute tests - name: Execute tests
shell: | shell: |
logfile={{ remote_artifacts }}/test.{{ item }}.log logfile={{ artifacts }}/test.{{ item }}.log
exec 2>>$logfile 1>>$logfile exec 2>>$logfile 1>>$logfile
cd tests cd tests
#make script executable #make script executable
@ -32,9 +23,9 @@
#execute the test #execute the test
python2 {{ item }}.py python2 {{ item }}.py
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "PASS {{ item }}" >> {{ remote_artifacts }}/test.log echo "PASS {{ item }}" >> {{ artifacts }}/test.log
else else
echo "FAIL {{ item }}" >> {{ remote_artifacts }}/test.log echo "FAIL {{ item }}" >> {{ artifacts }}/test.log
fi fi
with_items: with_items:
- "test_4GBsegfault" - "test_4GBsegfault"
@ -45,19 +36,10 @@
- "test_umask_when_creating" - "test_umask_when_creating"
- "test_zipnote_fails_to_update_the_archive" - "test_zipnote_fails_to_update_the_archive"
- name: Pull out the logs
synchronize:
dest: "{{ artifacts }}/"
src: "{{ remote_artifacts }}/"
mode: pull
ssh_args: "-o UserKnownHostsFile=/dev/null"
when: artifacts|default("") != ""
# Can't go in block. See # Can't go in block. See
# https://github.com/ansible/ansible/issues/20736 # https://github.com/ansible/ansible/issues/20736
- name: Check the results - name: Check the results
shell: grep "^FAIL" {{ remote_artifacts }}/test.log shell: grep "^FAIL" {{ artifacts }}/test.log
register: test_fails register: test_fails
failed_when: test_fails.stdout or test_fails.stderr failed_when: test_fails.stdout or test_fails.stderr