diff --git a/neutronclient/tests/functional/adv-svcs/__init__.py b/neutronclient/tests/functional/adv-svcs/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutronclient/tests/functional/adv-svcs/test_readonly_neutron_vpn.py b/neutronclient/tests/functional/adv-svcs/test_readonly_neutron_vpn.py new file mode 100644 index 000000000..ab3aba018 --- /dev/null +++ b/neutronclient/tests/functional/adv-svcs/test_readonly_neutron_vpn.py @@ -0,0 +1,55 @@ +# 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. + +from neutronclient.tests.functional import base + + +class SimpleReadOnlyNeutronVpnClientTest(base.ClientTestBase): + + """This is a first pass at a simple read only python-neutronclient test. + This only exercises vpn based client commands that are read only. + + This should test commands: + * as a regular user + * as a admin user + * with and without optional parameters + * initially just check return codes, and later test command outputs + + """ + + def test_neutron_vpn_ikepolicy_list(self): + ikepolicy = self.parser.listing(self.neutron('vpn-ikepolicy-list')) + self.assertTableStruct(ikepolicy, ['id', 'name', + 'auth_algorithm', + 'encryption_algorithm', + 'ike_version', 'pfs']) + + def test_neutron_vpn_ipsecpolicy_list(self): + ipsecpolicy = self.parser.listing(self.neutron('vpn-ipsecpolicy-list')) + self.assertTableStruct(ipsecpolicy, ['id', 'name', + 'auth_algorithm', + 'encryption_algorithm', + 'pfs']) + + def test_neutron_vpn_service_list(self): + vpn_list = self.parser.listing(self.neutron('vpn-service-list')) + self.assertTableStruct(vpn_list, ['id', 'name', + 'router_id', 'status']) + + def test_neutron_ipsec_site_connection_list(self): + ipsec_site = self.parser.listing(self.neutron + ('ipsec-site-connection-list')) + self.assertTableStruct(ipsec_site, ['id', 'name', + 'peer_address', + 'peer_cidrs', + 'route_mode', + 'auth_mode', 'status']) diff --git a/neutronclient/tests/functional/core/__init__.py b/neutronclient/tests/functional/core/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutronclient/tests/functional/test_clientlib.py b/neutronclient/tests/functional/core/test_clientlib.py similarity index 100% rename from neutronclient/tests/functional/test_clientlib.py rename to neutronclient/tests/functional/core/test_clientlib.py diff --git a/neutronclient/tests/functional/test_readonly_neutron.py b/neutronclient/tests/functional/core/test_readonly_neutron.py similarity index 79% rename from neutronclient/tests/functional/test_readonly_neutron.py rename to neutronclient/tests/functional/core/test_readonly_neutron.py index c088c5f92..d6ed1b8f7 100644 --- a/neutronclient/tests/functional/test_readonly_neutron.py +++ b/neutronclient/tests/functional/core/test_readonly_neutron.py @@ -11,7 +11,6 @@ # under the License. import re -import unittest2 from tempest_lib import exceptions @@ -124,38 +123,6 @@ class SimpleReadOnlyNeutronClientTest(base.ClientTestBase): self.assertTableStruct(subnet_list, ['id', 'name', 'cidr', 'allocation_pools']) - @unittest2.skip("Skipping until 1484148 is resolved") - def test_neutron_vpn_ikepolicy_list(self): - ikepolicy = self.parser.listing(self.neutron('vpn-ikepolicy-list')) - self.assertTableStruct(ikepolicy, ['id', 'name', - 'auth_algorithm', - 'encryption_algorithm', - 'ike_version', 'pfs']) - - @unittest2.skip("Skipping until 1484148 is resolved") - def test_neutron_vpn_ipsecpolicy_list(self): - ipsecpolicy = self.parser.listing(self.neutron('vpn-ipsecpolicy-list')) - self.assertTableStruct(ipsecpolicy, ['id', 'name', - 'auth_algorithm', - 'encryption_algorithm', - 'pfs']) - - @unittest2.skip("Skipping until 1484148 is resolved") - def test_neutron_vpn_service_list(self): - vpn_list = self.parser.listing(self.neutron('vpn-service-list')) - self.assertTableStruct(vpn_list, ['id', 'name', - 'router_id', 'status']) - - @unittest2.skip("Skipping until 1484148 is resolved") - def test_neutron_ipsec_site_connection_list(self): - ipsec_site = self.parser.listing(self.neutron - ('ipsec-site-connection-list')) - self.assertTableStruct(ipsec_site, ['id', 'name', - 'peer_address', - 'peer_cidrs', - 'route_mode', - 'auth_mode', 'status']) - def test_neutron_firewall_list(self): firewall_list = self.parser.listing(self.neutron ('firewall-list')) diff --git a/neutronclient/tests/functional/test_subnet_create.py b/neutronclient/tests/functional/core/test_subnet_create.py similarity index 100% rename from neutronclient/tests/functional/test_subnet_create.py rename to neutronclient/tests/functional/core/test_subnet_create.py diff --git a/neutronclient/tests/functional/hooks/gate_hook.sh b/neutronclient/tests/functional/hooks/gate_hook.sh index 4594c2249..9f1d8eb5b 100644 --- a/neutronclient/tests/functional/hooks/gate_hook.sh +++ b/neutronclient/tests/functional/hooks/gate_hook.sh @@ -3,11 +3,13 @@ set -ex +source $BASE/new/devstack-gate/functions.sh +start_timer VENV=${1:-"functional"} -if [ "$VENV" == "functional-vpn" ] +if [ "$VENV" == "functional-adv-svcs" ] then export DEVSTACK_LOCAL_CONFIG="enable_plugin neutron-vpnaas git://git.openstack.org/openstack/neutron-vpnaas" fi diff --git a/neutronclient/tests/functional/hooks/post_test_hook.sh b/neutronclient/tests/functional/hooks/post_test_hook.sh index 87cc29a65..b23fb4320 100755 --- a/neutronclient/tests/functional/hooks/post_test_hook.sh +++ b/neutronclient/tests/functional/hooks/post_test_hook.sh @@ -14,21 +14,43 @@ # This script is executed inside post_test_hook function in devstack gate. +SCRIPTS_DIR="/usr/os-testr-env/bin/" + +function generate_test_logs { + local path="$1" + # Compress all $path/*.txt files and move the directories holding those + # files to /opt/stack/logs. Files with .log suffix have their + # suffix changed to .txt (so browsers will know to open the compressed + # files and not download them). + if [ -d "$path" ] + then + sudo find $path -iname "*.log" -type f -exec mv {} {}.txt \; -exec gzip -9 {}.txt \; + sudo mv $path/* /opt/stack/logs/ + fi +} + function generate_testr_results { - if [ -f .testrepository/0 ]; then - sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit - sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit - sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html - sudo gzip -9 $BASE/logs/testrepository.subunit - sudo gzip -9 $BASE/logs/testr_results.html - sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz - sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz + # 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 + + if [ "$venv" == "functional" ] || [ "$venv" == "functional-adv-svcs" ] + then + generate_test_logs "/tmp/${venv}-logs" fi } export NEUTRONCLIENT_DIR="$BASE/new/python-neutronclient" +owner=jenkins -sudo chown -R jenkins:stack $NEUTRONCLIENT_DIR +sudo chown -R $owner:stack $NEUTRONCLIENT_DIR # Get admin credentials cd $BASE/new/devstack @@ -55,7 +77,7 @@ VENV=${1:-"functional"} echo "Running neutronclient functional test suite" set +e # Preserve env for OS_ credentials -sudo -E -H -u jenkins tox -e $VENV +sudo -E -H -u $owner tox -e $VENV EXIT_CODE=$? set -e diff --git a/tox.ini b/tox.ini index 7f705d18a..f9e00d6d8 100644 --- a/tox.ini +++ b/tox.ini @@ -24,7 +24,13 @@ commands = {posargs} [testenv:functional] setenv = - OS_TEST_PATH = ./neutronclient/tests/functional + OS_TEST_PATH = ./neutronclient/tests/functional/core + OS_NEUTRONCLIENT_EXEC_DIR = {envdir}/bin + +[testenv:functional-adv-svcs] +setenv = + OS_TEST_PATH = ./neutronclient/tests/functional/adv-svcs + OS_NEUTRONCLIENT_EXEC_DIR = {envdir}/bin [testenv:cover] commands = python setup.py testr --coverage --testr-args='{posargs}'