Fix subunit collection in functional tests with ostestr>=1.0.0

With the release of os-testr 1.0.0 stestr is used internally and because
of that the repository dir and commands to get subunit are different.
This commit updates the post-test hook to get the subunit stream if
ostestr>=1.0.0 is used.

Change-Id: I2cce7f4780ce418398b17a5848def9072372841e
This commit is contained in:
Matthew Treinish 2017-09-14 17:29:19 -04:00 committed by Dean Troyer
parent f63bb18003
commit 12552cee70
2 changed files with 16 additions and 0 deletions
openstackclient/tests/functional

@ -15,6 +15,14 @@ function generate_testr_results {
sudo gzip -9 $BASE/logs/testr_results.html
sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
elif [ -f .stestr/0 ]; then
sudo .tox/functional/bin/stestr last --subunit > $WORKSPACE/testrepository.subunit
sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit
sudo .tox/functional/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
sudo gzip -9 $BASE/logs/testrepository.subunit
sudo gzip -9 $BASE/logs/testr_results.html
sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
fi
}

@ -19,6 +19,14 @@ function generate_testr_results {
sudo gzip -9 $BASE/logs/testr_results.html
sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
elif [ -f .stestr/0 ]; then
sudo .tox/functional-tips/bin/stestr last --subunit > $WORKSPACE/testrepository.subunit
sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit
sudo .tox/functional-tips/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
sudo gzip -9 $BASE/logs/testrepository.subunit
sudo gzip -9 $BASE/logs/testr_results.html
sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
fi
}