neutron-fwaas/neutron_fwaas/tests/contrib/post_test_hook.sh
Nate Johnston 1f971199f1 Add fullstack testing for neutron-fwaas
Add a fullstack testing framework for neutron-fwaas.  This is a basic
first pass just to get the framework deployed; detailed non-plagiaristic
tests will be added after.  For more information on what fullstack
testing is, see:

http://git.openstack.org/cgit/openstack/neutron/tree/TESTING.rst#n213

Includes definition of fullstack job in new zuul syntax.

Co-Authored-By: Reedip Banerjee <reedip14@gmail.com>
Change-Id: I16cd2432606ef9aa6b7bf3e08efe82882e5585d9
2018-05-22 13:12:59 +00:00

51 lines
1.3 KiB
Bash

#!/usr/bin/env bash
set -xe
FWAAS_DIR="$BASE/new/neutron-fwaas"
NEUTRON_DIR="$BASE/new/neutron"
TEMPEST_DIR="$BASE/new/tempest"
SCRIPTS_DIR="/usr/os-testr-env/bin"
venv=${1:-"dsvm-functional"}
function generate_testr_results {
# Give job user rights to access tox logs
sudo -H -u $owner chmod o+rw .
sudo -H -u $owner chmod o+rw -R .testrepository
if [ -f ".testrepository/0" ] ; then
.tox/$venv/bin/subunit-1to2 < .testrepository/0 > ./testrepository.subunit
$SCRIPTS_DIR/subunit2html ./testrepository.subunit testr_results.html
gzip -9 ./testrepository.subunit
gzip -9 ./testr_results.html
sudo mv ./*.gz /opt/stack/logs/
fi
}
function dsvm_functional_prep_func {
:
}
if [[ "$venv" == dsvm-functional* ]] || [[ "$venv" == dsvm-fullstack* ]]
then
owner=stack
sudo_env=
# Set owner permissions according to job's requirements.
cd $FWAAS_DIR
sudo chown -R $owner:stack $FWAAS_DIR
sudo chown -R $owner:stack $NEUTRON_DIR
# Prep the environment according to job's requirements.
$prep_func
# Run tests
echo "Running neutron-fwaas $venv test suite"
set +e
sudo -H -u $owner $sudo_env tox -e $venv
testr_exit_code=$?
set -e
# Collect and parse results
generate_testr_results
exit $testr_exit_code
fi