Add constraints targets support for neutron-vpnaas

Added support for running the constraints version of DSVM
functional targets, made constraints targets the default for
gate invocation, and tested each target variation.

Removed the functional test coverage related targets, because to
run them, requires that DSVM is configured (like the functional
tests).

Conflict in tox.ini. Note: coverage target fails to run, but does
not in baseline either.

Change-Id: Idb9902418ea2e6f35b00ffb78a8973e49b6e140d
Partial-Bug: 1522503
(cherry picked from commit 80f765d498)
This commit is contained in:
Paul Michali 2016-01-21 17:40:06 +00:00
parent 427ba7e748
commit 90f8df474f
4 changed files with 90 additions and 47 deletions

View File

@ -37,16 +37,14 @@ esac
cd $NEUTRON_VPNAAS_DIR
sudo chown -R $owner:stack $NEUTRON_VPNAAS_DIR
# Run tests
# For gate, run all tests using constraints
VENV=$VENV-constraints
echo "Running neutron $VENV test suite"
set +e
sudo -H -u $owner $sudo_env tox -e $VENV
testr_exit_code=$?
set -e
echo "Dumping log from tox_install.sh"
cat /tmp/tox_install.txt
# Collect and parse results
generate_testr_results
exit $testr_exit_code

View File

@ -26,14 +26,16 @@ source $NEUTRON_VPNAAS_DIR/devstack/plugin.sh
function _install_vpn_package {
if [ "$VENV" == "dsvm-functional-sswan" ]
then
IPSEC_PACKAGE=strongswan
else
IPSEC_PACKAGE=openswan
fi
case $VENV in
dsvm-functional-sswan*)
IPSEC_PACKAGE=strongswan
;;
*)
IPSEC_PACKAGE=openswan
;;
esac
echo_summary "Installing $IPSEC_PACKAGE"
echo_summary "Installing $IPSEC_PACKAGE for $VENV"
neutron_agent_vpnaas_install_agent_packages
}

View File

@ -15,21 +15,27 @@
set -x
exec > /tmp/tox_install.txt 2>&1
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?)
NEUTRON_DIR=$HOME/neutron
set -e
install_cmd="pip install"
if [ "$1" = "constrained" ]; then
install_cmd="$install_cmd $2"
shift
fi
shift
if [ -d "$NEUTRON_DIR" ]; then
echo "FOUND Neutron code at $NEUTRON_DIR - using"
pip install -U -e $NEUTRON_DIR
$install_cmd -U -e $NEUTRON_DIR
elif [ $neutron_installed -eq 0 ]; then
location=$(python -c "import neutron; print(neutron.__file__)")
echo "ALREADY INSTALLED at $location"
elif [ -x "$ZUUL_CLONER" ]; then
export ZUUL_BRANCH=${ZUUL_BRANCH-$BRANCH}
echo "USING ZUUL CLONER to obtain Neutron code"
cwd=$(/bin/pwd)
cd /tmp
@ -38,12 +44,12 @@ elif [ -x "$ZUUL_CLONER" ]; then
git://git.openstack.org \
openstack/neutron
cd openstack/neutron
pip install -e .
$install_cmd -e .
cd "$cwd"
else
echo "LOCAL - Obtaining Neutron code from git.openstack.org"
pip install -U -egit+https://git.openstack.org/openstack/neutron@stable/liberty#egg=neutron
$install_cmd -U -egit+https://git.openstack.org/openstack/neutron@stable/liberty#egg=neutron
fi
pip install -U $*
$install_cmd -U $*
exit $?

97
tox.ini
View File

@ -1,12 +1,14 @@
[tox]
envlist = py27,py34,pep8,pylint
envlist = {py27,py34,pep8}-constraints,pylint
minversion = 1.6
skipsdist = True
[testenv]
setenv = VIRTUAL_ENV={envdir}
usedevelop = True
install_command = {toxinidir}/tools/tox_install.sh {opts} {packages}
install_command =
constraints: {[testenv:common-constraints]install_command}
{toxinidir}/tools/tox_install.sh unconstrained {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = sh
@ -15,41 +17,61 @@ commands =
# there is also secret magic in pretty_tox.sh which lets you run in a fail only
# mode. To do this define the TRACE_FAILONLY environmental variable.
[testenv:common-constraints]
install_command = {toxinidir}/tools/tox_install.sh constrained -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
[testenv:functional]
deps =
{[testenv]deps}
-r{toxinidir}/neutron_vpnaas/tests/functional/requirements.txt
[testenv:dsvm-functional]
setenv = OS_TEST_PATH=./neutron_vpnaas/tests/functional/openswan
OS_SUDO_TESTING=1
OS_ROOTWRAP_CMD=sudo {envdir}/bin/neutron-rootwrap {envdir}/etc/neutron/rootwrap.conf
OS_ROOTWRAP_DAEMON_CMD=sudo {envdir}/bin/neutron-rootwrap-daemon {envdir}/etc/neutron/rootwrap.conf
OS_FAIL_ON_MISSING_DEPS=1
deps =
{[testenv:functional]deps}
sitepackages=True
setenv =
OS_SUDO_TESTING=1
OS_ROOTWRAP_CMD=sudo {envdir}/bin/neutron-rootwrap {envdir}/etc/neutron/rootwrap.conf
OS_ROOTWRAP_DAEMON_CMD=sudo {envdir}/bin/neutron-rootwrap-daemon {envdir}/etc/neutron/rootwrap.conf
OS_FAIL_ON_MISSING_DEPS=1
whitelist_externals =
sh
cp
sudo
[testenv:dsvm-functional]
setenv =
OS_TEST_PATH=./neutron_vpnaas/tests/functional/openswan
{[testenv:functional]setenv}
deps = {[testenv:functional]deps}
sitepackages=True
whitelist_externals = {[testenv:functional]whitelist_externals}
commands =
{toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}
sh tools/pretty_tox.sh '{posargs}'
[testenv:dsvm-functional-constraints]
setenv = {[testenv:dsvm-functional]setenv}
deps = {[testenv:functional]deps}
sitepackages=True
install_command = {[testenv:common-constraints]install_command}
whitelist_externals = {[testenv:functional]whitelist_externals}
commands =
{toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}
sh tools/pretty_tox.sh '{posargs}'
[testenv:dsvm-functional-sswan]
setenv = OS_TEST_PATH=./neutron_vpnaas/tests/functional/strongswan
OS_SUDO_TESTING=1
OS_ROOTWRAP_CMD=sudo {envdir}/bin/neutron-rootwrap {envdir}/etc/neutron/rootwrap.conf
OS_ROOTWRAP_DAEMON_CMD=sudo {envdir}/bin/neutron-rootwrap-daemon {envdir}/etc/neutron/rootwrap.conf
OS_FAIL_ON_MISSING_DEPS=1
deps =
{[testenv:functional]deps}
setenv =
OS_TEST_PATH=./neutron_vpnaas/tests/functional/strongswan
{[testenv:functional]setenv}
deps = {[testenv:functional]deps}
sitepackages=True
whitelist_externals =
sh
cp
sudo
whitelist_externals = {[testenv:functional]whitelist_externals}
commands =
{toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}
sh tools/pretty_tox.sh '{posargs}'
[testenv:dsvm-functional-sswan-constraints]
setenv = {[testenv:dsvm-functional-sswan]setenv}
deps = {[testenv:functional]deps}
sitepackages=True
install_command = {[testenv:common-constraints]install_command}
whitelist_externals = {[testenv:functional]whitelist_externals}
commands =
{toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}
sh tools/pretty_tox.sh '{posargs}'
@ -69,6 +91,15 @@ commands =
neutron-db-manage --subproject neutron-vpnaas --database-connection sqlite:// check_migration
whitelist_externals = sh
[testenv:pep8-constraints]
install_command = {[testenv:common-constraints]install_command}
commands =
flake8
pylint --rcfile=.pylintrc --output-format=colorized {posargs:neutron_vpnaas}
{toxinidir}/tools/check_unit_test_structure.sh
neutron-db-manage --subproject neutron-vpnaas --database-connection sqlite:// check_migration
whitelist_externals = sh
[testenv:i18n]
commands = python ./tools/check_i18n.py ./neutron-vpnaas ./tools/i18n_cfg.py
@ -76,22 +107,25 @@ commands = python ./tools/check_i18n.py ./neutron-vpnaas ./tools/i18n_cfg.py
commands =
python setup.py test --coverage --coverage-package-name=neutron_vpnaas --testr-args='{posargs}'
[testenv:dsvm-functional-cover]
setenv = {[testenv:dsvm-functional]setenv}
commands =
python setup.py test --coverage --coverage-package-name=neutron_vpnaas --testr-args='{posargs}'
[testenv:dsvm-functional-sswan-cover]
setenv = {[testenv:dsvm-functional-sswan]setenv}
[testenv:cover-constraints]
install_command = {[testenv:common-constraints]install_command}
commands =
python setup.py test --coverage --coverage-package-name=neutron_vpnaas --testr-args='{posargs}'
[testenv:venv]
commands = {posargs}
[testenv:venv-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = {posargs}
[testenv:docs]
commands = sphinx-build -W -b html doc/source doc/build
[testenv:docs-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = {[testenv:docs]commands}
[testenv:py34]
commands = python -m testtools.run \
neutron_vpnaas.tests.unit.services.vpn.common.test_netns_wrapper \
@ -105,6 +139,9 @@ commands = python -m testtools.run \
neutron_vpnaas.tests.unit.services.vpn.service_drivers.test_ipsec \
neutron_vpnaas.tests.unit.services.vpn.service_drivers.test_cisco_ipsec
[testenv:py34-constraints]
commands = {[testenv:py34]commands}
[flake8]
# E125 continuation line does not distinguish itself from next logical line
# E126 continuation line over-indented for hanging indent