From 80f765d498b365c0622a375b78a85ae6e14cdfbc Mon Sep 17 00:00:00 2001 From: Paul Michali Date: Tue, 5 Jan 2016 14:24:05 -0500 Subject: [PATCH] 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). This will need I3a2c3c81533ce6145cd16c2a08a4a2af0dfb0d07 upstreamed, so that the constraints jobs can all be tested (as experimental). Change-Id: Idb9902418ea2e6f35b00ffb78a8973e49b6e140d Partial-Bug: 1522503 --- neutron_vpnaas/tests/contrib/gate_hook.sh | 1 + .../tests/contrib/post_test_hook.sh | 3 +- tools/configure_for_vpn_func_testing.sh | 16 ++-- tox.ini | 74 ++++++++++--------- 4 files changed, 53 insertions(+), 41 deletions(-) diff --git a/neutron_vpnaas/tests/contrib/gate_hook.sh b/neutron_vpnaas/tests/contrib/gate_hook.sh index e6096334d..530f72648 100755 --- a/neutron_vpnaas/tests/contrib/gate_hook.sh +++ b/neutron_vpnaas/tests/contrib/gate_hook.sh @@ -16,6 +16,7 @@ case $VENV in NEUTRON_VPN_PATH=$GATE_DEST/$PROJECT_NAME DEVSTACK_PATH=$GATE_DEST/devstack IS_GATE=True + USE_CONSTRAINT_ENV=True source $NEUTRON_VPN_PATH/tools/configure_for_vpn_func_testing.sh diff --git a/neutron_vpnaas/tests/contrib/post_test_hook.sh b/neutron_vpnaas/tests/contrib/post_test_hook.sh index b1709e0d1..875baf07a 100755 --- a/neutron_vpnaas/tests/contrib/post_test_hook.sh +++ b/neutron_vpnaas/tests/contrib/post_test_hook.sh @@ -37,7 +37,8 @@ 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 diff --git a/tools/configure_for_vpn_func_testing.sh b/tools/configure_for_vpn_func_testing.sh index 5439f9f9f..472952d28 100755 --- a/tools/configure_for_vpn_func_testing.sh +++ b/tools/configure_for_vpn_func_testing.sh @@ -27,14 +27,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 } diff --git a/tox.ini b/tox.ini index 25790878e..636907483 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py34,py27,pep8 +envlist = {py27,py34,pep8}-constraints minversion = 1.6 skipsdist = True @@ -24,37 +24,54 @@ install_command = {toxinidir}/tools/tox_install.sh constrained -c{env:UPPER_CONS 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}' @@ -78,7 +95,8 @@ commands = 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 = {[testenv:pep8]whitelist_externals} + {[testenv:genconfig]commands} +whitelist_externals = sh [testenv:i18n] commands = python ./tools/check_i18n.py ./neutron-vpnaas ./tools/i18n_cfg.py @@ -92,16 +110,6 @@ install_command = {[testenv:common-constraints]install_command} 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} -commands = - python setup.py test --coverage --coverage-package-name=neutron_vpnaas --testr-args='{posargs}' - [testenv:venv] commands = {posargs}