[CI] Fix logs for the functional test job

- Use roles from the openstack-infra/zuul-jobs
  repository to gather appropriate files after
  each job run.
- Gather the etc/ folder to gather test
  configuration.

Change-Id: I07676362e3b83cf2e50e177c1f37d926bb86c4ac
(cherry picked from commit dfd18798eb)
This commit is contained in:
Goutham Pacha Ravi 2019-01-17 02:23:56 -08:00
parent bba03045d2
commit 52760a69e2
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: primary
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