Allow to run functional tests
This change allows to run functional tests adding gate_hook.sh and post_test_hook.sh scripts. Partial-Bug: #1560003 Change-Id: I1d34e4f3eaf2ea8de9aab070513c6590e8e785dd
This commit is contained in:
parent
b116f47e7e
commit
a2ebd8704b
|
@ -0,0 +1,3 @@
|
||||||
|
The files in this directory are intended for use by the
|
||||||
|
infra jobs that run the various functional test
|
||||||
|
suite in the gate for the neutron-dynamic-routing repo.
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -xe
|
||||||
|
|
||||||
|
PROJECT_NAME=neutron-dynamic-routing
|
||||||
|
GATE_DEST=$BASE/new
|
||||||
|
NEUTRON_PATH=$GATE_DEST/neutron
|
||||||
|
DR_PATH=$GATE_DEST/$PROJECT_NAME
|
||||||
|
DEVSTACK_PATH=$GATE_DEST/devstack
|
||||||
|
|
||||||
|
VENV=${1:-"dsvm-functional"}
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "$VENV" == dsvm-functional* ]]
|
||||||
|
then
|
||||||
|
# The following need to be set before sourcing
|
||||||
|
# configure_for_func_testing.
|
||||||
|
GATE_STACK_USER=stack
|
||||||
|
IS_GATE=True
|
||||||
|
|
||||||
|
source $DEVSTACK_PATH/functions
|
||||||
|
source $NEUTRON_PATH/devstack/lib/ovs
|
||||||
|
source $NEUTRON_PATH/tools/configure_for_func_testing.sh
|
||||||
|
|
||||||
|
enable_plugin $PROJECT_NAME https://git.openstack.org/openstack/$PROJECT_NAME
|
||||||
|
|
||||||
|
# Make the workspace owned by the stack user
|
||||||
|
sudo chown -R $STACK_USER:$STACK_USER $BASE
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "Unrecognized environment $VENV".
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -xe
|
||||||
|
|
||||||
|
PROJECT_NAME=neutron-dynamic-routing
|
||||||
|
GATE_DEST=$BASE/new
|
||||||
|
NEUTRON_PATH=$GATE_DEST/neutron
|
||||||
|
DR_PATH=$GATE_DEST/$PROJECT_NAME
|
||||||
|
SCRIPTS_PATH="/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_PATH/subunit2html ./testrepository.subunit testr_results.html
|
||||||
|
gzip -9 ./testrepository.subunit
|
||||||
|
gzip -9 ./testr_results.html
|
||||||
|
sudo mv ./*.gz /opt/stack/logs/
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "$VENV" == dsvm-functional* ]]
|
||||||
|
then
|
||||||
|
OWNER=stack
|
||||||
|
SUDO_ENV=
|
||||||
|
|
||||||
|
# Set owner permissions according to job's requirements.
|
||||||
|
sudo chown -R $OWNER:stack $NEUTRON_PATH
|
||||||
|
sudo chown -R $OWNER:stack $DR_PATH
|
||||||
|
cd $DR_PATH
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
echo "Running $PROJECT_NAME $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
|
2
tox.ini
2
tox.ini
|
@ -44,7 +44,7 @@ whitelist_externals =
|
||||||
cp
|
cp
|
||||||
sudo
|
sudo
|
||||||
commands =
|
commands =
|
||||||
python setup.py testr --slowest --testr-args='{posargs}'
|
sh tools/pretty_tox.sh '{posargs}'
|
||||||
|
|
||||||
[testenv:releasenotes]
|
[testenv:releasenotes]
|
||||||
# TODO(ihrachys): remove once infra supports constraints for this target
|
# TODO(ihrachys): remove once infra supports constraints for this target
|
||||||
|
|
Loading…
Reference in New Issue