Create Junit XML Report from tempest run

Tempest results are currently written to stdout as part of a test run.
This output is difficult to parse. This patch adds steps to generate an
XML report, and make this report available in /tmp on a physical host.

The report is copied to a physical host so that external systems that do
not have knowledge of the container inventory can retrieve the report,
for example Jenkins.

* Add pip packages python-subunit and junitxml to tempest venv, needed
  to convert the subunit stream stored in testrepository to junit XML.

* openstack_tempest_gate:
    After a tempest run completes, the subunit stream is extracted from
    the testrepository, converted to junit XML and written to /tmp in
    the utility container running the tests.

* run-tempest.sh
    After running openstack_tempest_gate, retrieve XML results and write
    them to /tmp on the host.

Change-Id: I897024f545dd2a90f80b0d5c0aa558f335dc963a
Closes-Bug: #1464686
This commit is contained in:
Hugh Saunders 2015-06-11 11:35:39 +01:00 committed by kevin
parent 86b6e8e640
commit 8a7d5179d6
3 changed files with 14 additions and 0 deletions

View File

@ -91,6 +91,8 @@ tempest_pip_packages:
- testrepository
- testscenarios
- testtools
- python-subunit
- junitxml
tempest_image_dir: "/opt/images"
tempest_images:

View File

@ -185,6 +185,14 @@ echo "Using test list $test_list_summary"
# execute chosen tests with pretty output
./run_tempest.sh --no-virtual-env ${RUN_TEMPEST_OPTS} -- --load-list test_list ${TESTR_OPTS};
result=$?
# Create junit xml report from test results
subunit-1to2 < .testrepository/0 | subunit2junitxml > tempest_results.xml
cp tempest_results.xml /tmp
if [ -d "/var/log/utility" ];then
# Copy the log to the utility logging directory
cp tempest_results.xml /var/log/utility/tempest_results_$(date +%Y%d%m-%H%M%S).xml
fi
popd
if [[ $result == 0 ]]; then

View File

@ -50,4 +50,8 @@ pushd playbooks
ansible 'utility[0]' -m shell -a "export RUN_TEMPEST_OPTS=${RUN_TEMPEST_OPTS}; \
export TESTR_OPTS=${TESTR_OPTS}; \
${TEMPEST_SCRIPT_PATH} ${TEMPEST_SCRIPT_PARAMETERS}"
# Retrieve tempest test results
ansible 'utility[0]' -m fetch -a 'src=/tmp/tempest_results.xml dest=/tmp/ flat=true'
popd