VPNaaS: Enable StrongSwan in gate hook
To support running the new neutron-vpnaas-dsvm-functional-sswan functional job, this commit enables StrongSwan process for DevStack, when the argument passed in is dsvm-functional-sswan. The existing functional job, neutron-vpnaas-dsvm-functional, uses the argument dsvm-functional, which will use OpenSwan. In addition, tox commands are modified so that dsvm-functional will run the tests in tests/functional/openswan/, and dsvm-functional-sswan will run tests in tests/functional/strongswan/. Both jobs will use the load_tests method in __init__.py to also run test modules in tests/functional/common, in case there are tests that are common to both jobs. README files were added to indicate what each directory is used for, and dummy test modules created to verify the jobs. Lastly, a coverage command (dsvm-functional-sswan-cover) was created to provide coverage for StrongSwan specific tests. Change-Id: I78a053c71fa87eab2d1f1585dd4c261506e34644 Partial-Bug: 1424757
This commit is contained in:
parent
f45fb8af13
commit
02e6908782
@ -4,6 +4,13 @@ set -ex
|
||||
|
||||
CONTRIB_DIR="$BASE/new/neutron-vpnaas/neutron_vpnaas/tests/contrib"
|
||||
|
||||
# Have DevStack use StrongSwan (instead of OpenSwan) for VPNaaS
|
||||
if [[ "$1" == "dsvm-functional-sswan" ]]; then
|
||||
DEVSTACK_LOCAL_CONFIG=$'IPSEC_PACKAGE=strongswan\n'
|
||||
export DEVSTACK_LOCAL_CONFIG
|
||||
export KEEP_LOCALRC=1
|
||||
fi
|
||||
|
||||
$BASE/new/devstack-gate/devstack-vm-gate.sh
|
||||
|
||||
# Add a rootwrap filter to support test-only
|
||||
@ -51,3 +58,4 @@ EOF
|
||||
# User/group postgres needs to be given access to tmp_dir
|
||||
setfacl -m g:postgres:rwx $tmp_dir
|
||||
sudo -u postgres /usr/bin/psql --file=$tmp_dir/postgresql.sql
|
||||
|
||||
|
@ -6,25 +6,25 @@ NEUTRON_DIR="$BASE/new/neutron-vpnaas"
|
||||
TEMPEST_DIR="$BASE/new/tempest"
|
||||
SCRIPTS_DIR="/usr/local/jenkins/slave_scripts"
|
||||
|
||||
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/dsvm-functional/bin/subunit-1to2 < .testrepository/0 > ./testrepository.subunit
|
||||
.tox/dsvm-functional/bin/python $SCRIPTS_DIR/subunit2html.py ./testrepository.subunit testr_results.html
|
||||
.tox/$venv/bin/subunit-1to2 < .testrepository/0 > ./testrepository.subunit
|
||||
.tox/$venv/bin/python $SCRIPTS_DIR/subunit2html.py ./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 {
|
||||
:
|
||||
}
|
||||
|
||||
|
||||
owner=stack
|
||||
prep_func="dsvm_functional_prep_func"
|
||||
|
||||
@ -37,7 +37,7 @@ $prep_func
|
||||
# Run tests
|
||||
echo "Running neutron dsvm-functional test suite"
|
||||
set +e
|
||||
sudo -H -u $owner tox -e dsvm-functional
|
||||
sudo -H -u $owner tox -e $venv
|
||||
testr_exit_code=$?
|
||||
set -e
|
||||
|
||||
|
5
neutron_vpnaas/tests/functional/common/README
Normal file
5
neutron_vpnaas/tests/functional/common/README
Normal file
@ -0,0 +1,5 @@
|
||||
This area holds tests that are run for all functional jobs. The load_test()
|
||||
method in each implementation specific area will include tests in this area.
|
||||
Do not place a test module in this area, if it is specific to one particular
|
||||
implementation.
|
||||
|
0
neutron_vpnaas/tests/functional/common/__init__.py
Normal file
0
neutron_vpnaas/tests/functional/common/__init__.py
Normal file
26
neutron_vpnaas/tests/functional/common/test_scenario.py
Normal file
26
neutron_vpnaas/tests/functional/common/test_scenario.py
Normal file
@ -0,0 +1,26 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# NOTE: The purpose of this module is to provide nop tests to verify that
|
||||
# the functional gate is working.
|
||||
|
||||
# TODO(pcm): In the future, this will be replaced with a real scenario test.
|
||||
|
||||
from neutron.tests.functional.agent.linux import base
|
||||
|
||||
|
||||
class TestIPSecScenario(base.BaseLinuxTestCase):
|
||||
|
||||
"""Test end-to-end IPSec connection."""
|
||||
|
||||
def test_dummy(self):
|
||||
pass
|
2
neutron_vpnaas/tests/functional/openswan/README
Normal file
2
neutron_vpnaas/tests/functional/openswan/README
Normal file
@ -0,0 +1,2 @@
|
||||
This area holds tests for the OpenSwan implementation (only). It will also
|
||||
run tests in neutron_vpnaas/tests/functional/common.
|
31
neutron_vpnaas/tests/functional/openswan/__init__.py
Normal file
31
neutron_vpnaas/tests/functional/openswan/__init__.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import unittest
|
||||
|
||||
|
||||
def _discover(loader, path, pattern):
|
||||
return loader.discover(path, pattern=pattern, top_level_dir=".")
|
||||
|
||||
|
||||
def load_tests(_, tests, pattern):
|
||||
suite = unittest.TestSuite()
|
||||
suite.addTests(tests)
|
||||
|
||||
loader = unittest.loader.TestLoader()
|
||||
suite.addTests(_discover(loader,
|
||||
"./neutron_vpnaas/tests/functional/openswan",
|
||||
pattern))
|
||||
suite.addTests(_discover(loader,
|
||||
"./neutron_vpnaas/tests/functional/common",
|
||||
pattern))
|
||||
return suite
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# NOTE: The purpose of this module is to provide a nop test to verify that
|
||||
# NOTE: The purpose of this module is to provide nop tests to verify that
|
||||
# the functional gate is working.
|
||||
|
||||
# TODO(pcm): In the future, repurpose this module for use in a "real"
|
||||
|
2
neutron_vpnaas/tests/functional/strongswan/README
Normal file
2
neutron_vpnaas/tests/functional/strongswan/README
Normal file
@ -0,0 +1,2 @@
|
||||
This area holds tests for the StrongSwan implementation (only). It will also
|
||||
run tests in neutron_vpnaas/tests/functional/common.
|
31
neutron_vpnaas/tests/functional/strongswan/__init__.py
Normal file
31
neutron_vpnaas/tests/functional/strongswan/__init__.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import unittest
|
||||
|
||||
|
||||
def _discover(loader, path, pattern):
|
||||
return loader.discover(path, pattern=pattern, top_level_dir=".")
|
||||
|
||||
|
||||
def load_tests(_, tests, pattern):
|
||||
suite = unittest.TestSuite()
|
||||
suite.addTests(tests)
|
||||
|
||||
loader = unittest.loader.TestLoader()
|
||||
suite.addTests(_discover(loader,
|
||||
"./neutron_vpnaas/tests/functional/strongswan",
|
||||
pattern))
|
||||
suite.addTests(_discover(loader,
|
||||
"./neutron_vpnaas/tests/functional/common",
|
||||
pattern))
|
||||
return suite
|
@ -14,7 +14,7 @@
|
||||
# the functional gate is working for the StrongSwan device driver.
|
||||
|
||||
# TODO(pcm): In the future, this module will be replace, in whole, with
|
||||
# actual StrongSwan driver test cases.
|
||||
# actual StrongSwan driver test classes/cases.
|
||||
|
||||
|
||||
from neutron.tests.functional.agent.linux import base
|
||||
|
16
tox.ini
16
tox.ini
@ -31,7 +31,16 @@ commands =
|
||||
python setup.py testr --slowest --testr-args='{posargs}'
|
||||
|
||||
[testenv:dsvm-functional]
|
||||
setenv = OS_TEST_PATH=./neutron_vpnaas/tests/functional
|
||||
setenv = OS_TEST_PATH=./neutron_vpnaas/tests/functional/openswan
|
||||
OS_SUDO_TESTING=1
|
||||
OS_ROOTWRAP_CMD=sudo /usr/local/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
|
||||
OS_FAIL_ON_MISSING_DEPS=1
|
||||
sitepackages=True
|
||||
commands =
|
||||
python setup.py testr --slowest --testr-args='{posargs}'
|
||||
|
||||
[testenv:dsvm-functional-sswan]
|
||||
setenv = OS_TEST_PATH=./neutron_vpnaas/tests/functional/strongswan
|
||||
OS_SUDO_TESTING=1
|
||||
OS_ROOTWRAP_CMD=sudo /usr/local/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
|
||||
OS_FAIL_ON_MISSING_DEPS=1
|
||||
@ -63,6 +72,11 @@ setenv = {[testenv:dsvm-functional]setenv}
|
||||
commands =
|
||||
python setup.py testr --coverage --coverage-package-name=neutron_vpnaas --testr-args='{posargs}'
|
||||
|
||||
[testenv:dsvm-functional-sswan-cover]
|
||||
setenv = {[testenv:dsvm-functional-sswan]setenv}
|
||||
commands =
|
||||
python setup.py testr --coverage --coverage-package-name=neutron_vpnaas --testr-args='{posargs}'
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user