Enable VPN test cases

With the gate hook changes from Ieeaca1375d68705509f4e05f10cb35c0fa0b9582 and
new jobs from I2db939bf99288c0cdec06cdd49fec3bdc72e5253, this commit does
several things:

    * Moves test modules to tests/functional/core/
    * Moves VPN test cases to new module & places in tests/functional/adv-svcs
    * Modifies tox.ini to support 'functional' and 'functional-adv-svcs' test

This commit will be used to test the experimental jobs, one that runs the
same tests as before, one that runs VPN tests using the VPN DevStack plugin
via the gate-hook.sh.

Modified post test hook so that test results are properly created (was not
seeing results from testr, prior to this).

Goal is to place all advanced services into tests/functional/adv-svcs/ and
use plugins, as needed in the gate hook.

Change-Id: I1e3d19e51a1cbd1bc947bbf9927260cd4d73841a
Depends-On: I2db939bf99288c0cdec06cdd49fec3bdc72e5253
Partial-Bug: 1484148
This commit is contained in:
Paul Michali 2015-08-19 12:16:05 +00:00
parent 3e115991c1
commit b915201dbf
9 changed files with 97 additions and 45 deletions

View File

@ -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'])

View File

@ -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'))

View File

@ -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

View File

@ -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

View File

@ -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}'