Merge "[CI] Fix logs for the functional test job"

This commit is contained in:
Zuul 2019-01-19 16:57:24 +00:00 committed by Gerrit Code Review
commit 33874ed894
2 changed files with 16 additions and 99 deletions

View File

@ -101,38 +101,7 @@ CONCURRENCY=${CONCURRENCY:-8}
sudo -H -u $USER tox -e functional -v -- --concurrency=$CONCURRENCY
EXIT_CODE=$?
if [ -d ".testrepository" ] ; then
if [ -f ".testrepository/0.2" ] ; then
cp .testrepository/0.2 ./subunit_log.txt
elif [ -f ".testrepository/0" ] ; then
.tox/functional/bin/subunit-1to2 < .testrepository/0 > ./subunit_log.txt
fi
/usr/os-testr-env/bin/subunit2html ./subunit_log.txt testr_results.html
SUBUNIT_SIZE=$(du -k ./subunit_log.txt | awk '{print $1}')
gzip -9 ./subunit_log.txt
gzip -9 ./testr_results.html
sudo mv testr_results.html.gz $WORKSPACE/logs
sudo mv subunit_log.txt.gz $WORKSPACE/logs
sudo cp -R .tox $WORKSPACE
sudo cp -R .testrepository $WORKSPACE
# Copy artifacts into ZUUL's workspace
sudo -H -u $USER cp -r $MANILACLIENT_DIR $WORKSPACE
if [[ "$SUBUNIT_SIZE" -gt 50000 ]]; then
echo
echo "sub_unit.log was greater than 50 MB of uncompressed data!"
echo "Something is causing tests for this project to log significant amounts of data."
echo "This may be writers to python logging, stdout, or stderr."
echo "Failing this test as a result."
echo
exit 1
fi
rancount=$(.tox/functional/bin/testr last | sed -ne 's/Ran \([0-9]\+\).*tests in.*/\1/p')
if [ -z "$rancount" ] || [ "$rancount" -eq "0" ] ; then
echo
echo "Zero tests were run. At least one test should have been run."
echo "Failing this test as a result."
echo
exit 1
fi
fi
return $EXIT_CODE
return $EXIT_CODE

View File

@ -1,75 +1,23 @@
- hosts: controller
roles:
- role: fetch-tox-output
zuul_work_dir: "{{ ansible_user_dir }}/workspace/python-manilaclient"
tox_envlist: functional
- role: fetch-subunit-output
zuul_work_dir: "{{ ansible_user_dir }}/workspace/python-manilaclient"
tox_envlist: functional
tasks:
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
- name: Copy job config files
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
src: "{{ ansible_user_dir }}/workspace/python-manilaclient/etc"
dest: "{{ zuul.executor.log_root }}"
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=**/*nose_results.html
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=**/*testr_results.html.gz
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/.testrepository/tmp*
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=**/*testrepository.subunit.gz
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}/tox'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/.tox/*/log/*
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
src: "{{ ansible_user_dir }}/workspace/"
dest: "{{ zuul.executor.log_root }}"
mode: pull
copy_links: true
verify_host: true