Merge "Set up hooks for the functional job and add test_migrations test"
This commit is contained in:
commit
94b3223174
|
@ -28,9 +28,6 @@ function neutron_lbaas_configure_common {
|
||||||
die $LINENO "Do not enable both Version 1 and Version 2 of LBaaS."
|
die $LINENO "Do not enable both Version 1 and Version 2 of LBaaS."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Uses oslo config generator to generate LBaaS sample configuration files
|
|
||||||
(cd $NEUTRON_LBAAS_DIR && exec ./tools/generate_config_file_samples.sh)
|
|
||||||
|
|
||||||
cp $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf.sample $NEUTRON_LBAAS_CONF
|
cp $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf.sample $NEUTRON_LBAAS_CONF
|
||||||
|
|
||||||
if is_service_enabled $LBAAS_V1; then
|
if is_service_enabled $LBAAS_V1; then
|
||||||
|
@ -69,21 +66,29 @@ function neutron_lbaas_configure_common {
|
||||||
}
|
}
|
||||||
|
|
||||||
function neutron_lbaas_configure_agent {
|
function neutron_lbaas_configure_agent {
|
||||||
mkdir -p $LBAAS_AGENT_CONF_PATH
|
if [ -z "$1" ]; then
|
||||||
cp $NEUTRON_LBAAS_DIR/etc/lbaas_agent.ini.sample $LBAAS_AGENT_CONF_FILENAME
|
mkdir -p $LBAAS_AGENT_CONF_PATH
|
||||||
|
fi
|
||||||
|
conf=${1:-$LBAAS_AGENT_CONF_FILENAME}
|
||||||
|
cp $NEUTRON_LBAAS_DIR/etc/lbaas_agent.ini.sample $conf
|
||||||
|
|
||||||
# ovs_use_veth needs to be set before the plugin configuration
|
# ovs_use_veth needs to be set before the plugin configuration
|
||||||
# occurs to allow plugins to override the setting.
|
# occurs to allow plugins to override the setting.
|
||||||
iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT ovs_use_veth $Q_OVS_USE_VETH
|
iniset $conf DEFAULT ovs_use_veth $Q_OVS_USE_VETH
|
||||||
|
|
||||||
neutron_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME
|
neutron_plugin_setup_interface_driver $conf
|
||||||
|
|
||||||
if is_fedora; then
|
if is_fedora; then
|
||||||
iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody"
|
iniset $conf DEFAULT user_group "nobody"
|
||||||
iniset $LBAAS_AGENT_CONF_FILENAME haproxy user_group "nobody"
|
iniset $conf haproxy user_group "nobody"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function neutron_lbaas_generate_config_files {
|
||||||
|
# Uses oslo config generator to generate LBaaS sample configuration files
|
||||||
|
(cd $NEUTRON_LBAAS_DIR && exec ./tools/generate_config_file_samples.sh)
|
||||||
|
}
|
||||||
|
|
||||||
function neutron_lbaas_start {
|
function neutron_lbaas_start {
|
||||||
local is_run_process=True
|
local is_run_process=True
|
||||||
|
|
||||||
|
@ -134,6 +139,7 @@ if is_service_enabled $LBAAS_ANY; then
|
||||||
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||||
# Configure after the other layer 1 and 2 services have been configured
|
# Configure after the other layer 1 and 2 services have been configured
|
||||||
echo_summary "Configuring neutron-lbaas"
|
echo_summary "Configuring neutron-lbaas"
|
||||||
|
neutron_lbaas_generate_config_files
|
||||||
neutron_lbaas_configure_common
|
neutron_lbaas_configure_common
|
||||||
neutron_lbaas_configure_agent
|
neutron_lbaas_configure_agent
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,11 @@
|
||||||
|
|
||||||
from neutron.db.migration.models import head
|
from neutron.db.migration.models import head
|
||||||
|
|
||||||
|
import neutron_lbaas.agent_scheduler # noqa
|
||||||
import neutron_lbaas.db.loadbalancer.loadbalancer_db # noqa
|
import neutron_lbaas.db.loadbalancer.loadbalancer_db # noqa
|
||||||
import neutron_lbaas.db.loadbalancer.models # noqa
|
import neutron_lbaas.db.loadbalancer.models # noqa
|
||||||
|
import neutron_lbaas.services.loadbalancer.agent_scheduler # noqa
|
||||||
|
import neutron_lbaas.services.loadbalancer.drivers.vmware.models # noqa
|
||||||
|
|
||||||
|
|
||||||
def get_metadata():
|
def get_metadata():
|
||||||
|
|
|
@ -27,32 +27,39 @@
|
||||||
testtype="$1"
|
testtype="$1"
|
||||||
lbaasversion="$2"
|
lbaasversion="$2"
|
||||||
lbaastest="$3"
|
lbaastest="$3"
|
||||||
lbaasenv=$(echo "$lbaastest" | perl -ne '/^(.*)-([^-]+)$/ && print "$1";')
|
|
||||||
if [ -z "$lbaasenv" ]; then
|
|
||||||
lbaasenv=$lbaastest
|
|
||||||
fi
|
|
||||||
lbaasdriver=$(echo "$lbaastest" | perl -ne '/^(.*)-([^-]+)$/ && print "$2";')
|
|
||||||
if [ -z "$lbaasdriver" ]; then
|
|
||||||
lbaasdriver='octavia'
|
|
||||||
fi
|
|
||||||
|
|
||||||
testenv=${lbaastest:-"apiv2"}
|
case $testtype in
|
||||||
|
"dsvm-functional")
|
||||||
|
testenv=$testtype
|
||||||
|
;;
|
||||||
|
|
||||||
if [ "$lbaasversion" = "lbaasv1" ]; then
|
"tempest")
|
||||||
testenv="apiv1"
|
lbaasenv=$(echo "$lbaastest" | perl -ne '/^(.*)-([^-]+)$/ && print "$1";')
|
||||||
elif [ "$lbaasversion" = "lbaasv2" ]; then
|
if [ -z "$lbaasenv" ]; then
|
||||||
case "$lbaasenv" in
|
lbaasenv=$lbaastest
|
||||||
"api"|"healthmonitor"|"listener"|"loadbalancer"|"member"|"minimal"|"pool")
|
fi
|
||||||
testenv="apiv2"
|
lbaasdriver=$(echo "$lbaastest" | perl -ne '/^(.*)-([^-]+)$/ && print "$2";')
|
||||||
;;
|
if [ -z "$lbaasdriver" ]; then
|
||||||
"scenario")
|
lbaasdriver='octavia'
|
||||||
testenv="scenario"
|
fi
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unrecognized env $lbaasenv".
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
testenv=${lbaastest:-"apiv2"}
|
||||||
|
|
||||||
|
if [ "$lbaasversion" = "lbaasv1" ]; then
|
||||||
|
testenv="apiv1"
|
||||||
|
elif [ "$lbaasversion" = "lbaasv2" ]; then
|
||||||
|
case "$lbaasenv" in
|
||||||
|
"api"|"healthmonitor"|"listener"|"loadbalancer"|"member"|"minimal"|"pool")
|
||||||
|
testenv="apiv2"
|
||||||
|
;;
|
||||||
|
"scenario")
|
||||||
|
testenv="scenario"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unrecognized env $lbaasenv".
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
|
@ -50,6 +50,21 @@ EOF
|
||||||
|
|
||||||
case "$testtype" in
|
case "$testtype" in
|
||||||
|
|
||||||
|
"dsvm-functional")
|
||||||
|
PROJECT_NAME=neutron-lbaas
|
||||||
|
NEUTRON_LBAAS_PATH=$GATE_DEST/$PROJECT_NAME
|
||||||
|
DEVSTACK_PATH=$GATE_DEST/devstack
|
||||||
|
IS_GATE=True
|
||||||
|
USE_CONSTRAINT_ENV=False
|
||||||
|
export LOG_COLOR=False
|
||||||
|
source "$NEUTRON_LBAAS_PATH"/tools/configure_for_lbaas_func_testing.sh
|
||||||
|
|
||||||
|
# Make the workspace owned by the stack user
|
||||||
|
sudo chown -R "$STACK_USER":"$STACK_USER" "$BASE"
|
||||||
|
|
||||||
|
configure_host_for_lbaas_func_testing
|
||||||
|
;;
|
||||||
|
|
||||||
"tempest")
|
"tempest")
|
||||||
# These are not needed with either v1 or v2
|
# These are not needed with either v1 or v2
|
||||||
ENABLED_SERVICES+="-c-api,-c-bak,-c-sch,-c-vol,-cinder,"
|
ENABLED_SERVICES+="-c-api,-c-bak,-c-sch,-c-vol,-cinder,"
|
||||||
|
@ -83,6 +98,7 @@ case "$testtype" in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export ENABLED_SERVICES
|
export ENABLED_SERVICES
|
||||||
|
"$GATE_DEST"/devstack-gate/devstack-vm-gate.sh
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
@ -90,6 +106,3 @@ case "$testtype" in
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
"$GATE_DEST"/devstack-gate/devstack-vm-gate.sh
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ function generate_testr_results {
|
||||||
sudo -H -u "$owner" chmod o+rw .
|
sudo -H -u "$owner" chmod o+rw .
|
||||||
sudo -H -u "$owner" chmod o+rw -R .testrepository
|
sudo -H -u "$owner" chmod o+rw -R .testrepository
|
||||||
if [ -f ".testrepository/0" ] ; then
|
if [ -f ".testrepository/0" ] ; then
|
||||||
subunit-1to2 < .testrepository/0 > ./testrepository.subunit
|
.tox/"$testenv"/bin/subunit-1to2 < .testrepository/0 > ./testrepository.subunit
|
||||||
$SCRIPTS_DIR/subunit2html ./testrepository.subunit testr_results.html
|
$SCRIPTS_DIR/subunit2html ./testrepository.subunit testr_results.html
|
||||||
gzip -9 ./testrepository.subunit
|
gzip -9 ./testrepository.subunit
|
||||||
gzip -9 ./testr_results.html
|
gzip -9 ./testr_results.html
|
||||||
|
@ -56,9 +56,17 @@ function generate_testr_results {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
owner=tempest
|
case $testtype in
|
||||||
# Configure the api and scenario tests to use the tempest.conf set by devstack
|
"dsvm-functional")
|
||||||
sudo_env="TEMPEST_CONFIG_DIR=$TEMPEST_CONFIG_DIR"
|
owner=stack
|
||||||
|
sudo_env=
|
||||||
|
;;
|
||||||
|
"tempest")
|
||||||
|
owner=tempest
|
||||||
|
# Configure the api and scenario tests to use the tempest.conf set by devstack
|
||||||
|
sudo_env="TEMPEST_CONFIG_DIR=$TEMPEST_CONFIG_DIR"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Set owner permissions according to job's requirements.
|
# Set owner permissions according to job's requirements.
|
||||||
cd "$NEUTRON_LBAAS_DIR"
|
cd "$NEUTRON_LBAAS_DIR"
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Additional requirements for functional tests
|
||||||
|
|
||||||
|
# The order of packages is significant, because pip processes them in the order
|
||||||
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
|
psutil>=1.1.1,<2.0.0
|
||||||
|
psycopg2
|
||||||
|
PyMySQL>=0.6.2 # MIT License
|
|
@ -19,6 +19,4 @@ testscenarios>=0.4 # Apache-2.0/BSD
|
||||||
WebOb>=1.2.3 # MIT
|
WebOb>=1.2.3 # MIT
|
||||||
WebTest>=2.0 # MIT
|
WebTest>=2.0 # MIT
|
||||||
reno>=1.8.0 # Apache2
|
reno>=1.8.0 # Apache2
|
||||||
# Needed to run DB commands in virtualenvs
|
|
||||||
PyMySQL>=0.6.2 # MIT License
|
|
||||||
tempest>=12.1.0 # Apache-2.0
|
tempest>=12.1.0 # Apache-2.0
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
IS_GATE=${IS_GATE:-False}
|
||||||
|
USE_CONSTRAINT_ENV=${USE_CONSTRAINT_ENV:-False}
|
||||||
|
PROJECT_NAME=${PROJECT_NAME:-neutron-lbaas}
|
||||||
|
REPO_BASE=${GATE_DEST:-$(cd $(dirname "$BASH_SOURCE")/../.. && pwd)}
|
||||||
|
|
||||||
|
source $REPO_BASE/neutron/tools/configure_for_func_testing.sh
|
||||||
|
|
||||||
|
|
||||||
|
function configure_host_for_lbaas_func_testing {
|
||||||
|
echo_summary "Configuring for LBaaS functional testing"
|
||||||
|
if [ "$IS_GATE" == "True" ]; then
|
||||||
|
configure_host_for_func_testing
|
||||||
|
fi
|
||||||
|
|
||||||
|
source $REPO_BASE/neutron-lbaas/devstack/settings
|
||||||
|
source $NEUTRON_LBAAS_DIR/devstack/plugin.sh
|
||||||
|
|
||||||
|
local temp_ini=$(mktemp)
|
||||||
|
|
||||||
|
# Note(pc_m): Need to ensure this is installed so we have
|
||||||
|
# oslo-config-generator present (as this script runs before tox.ini).
|
||||||
|
sudo pip install --force oslo.config
|
||||||
|
neutron_lbaas_generate_config_files
|
||||||
|
neutron_agent_lbaas_install_agent_packages
|
||||||
|
neutron_lbaas_configure_agent $temp_ini
|
||||||
|
|
||||||
|
sudo install -d -o $STACK_USER $LBAAS_AGENT_CONF_PATH
|
||||||
|
sudo install -m 644 -o $STACK_USER $temp_ini $LBAAS_AGENT_CONF_FILENAME
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$IS_GATE" != "True" ]; then
|
||||||
|
configure_host_for_lbaas_func_testing
|
||||||
|
fi
|
21
tox.ini
21
tox.ini
|
@ -63,6 +63,27 @@ exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject,ra
|
||||||
import_exceptions = neutron_lbaas._i18n
|
import_exceptions = neutron_lbaas._i18n
|
||||||
local-check-factory = neutron_lib.hacking.checks.factory
|
local-check-factory = neutron_lib.hacking.checks.factory
|
||||||
|
|
||||||
|
[testenv:functional]
|
||||||
|
basepython = python2.7
|
||||||
|
setenv = {[testenv]setenv}
|
||||||
|
OS_TEST_PATH={toxinidir}/neutron_lbaas/tests/functional
|
||||||
|
OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
|
||||||
|
deps =
|
||||||
|
{[testenv]deps}
|
||||||
|
-r{toxinidir}/neutron_lbaas/tests/functional/requirements.txt
|
||||||
|
|
||||||
|
[testenv:dsvm-functional]
|
||||||
|
setenv = {[testenv]setenv}
|
||||||
|
{[testenv:functional]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
|
||||||
|
deps =
|
||||||
|
{[testenv:functional]deps}
|
||||||
|
commands =
|
||||||
|
sh tools/pretty_tox.sh '{posargs}'
|
||||||
|
|
||||||
# If you are running the tests locally you should set the env variable
|
# If you are running the tests locally you should set the env variable
|
||||||
# TEMPEST_CONFIG_DIR=/opt/stack/tempest/etc
|
# TEMPEST_CONFIG_DIR=/opt/stack/tempest/etc
|
||||||
[testenv:apiv1]
|
[testenv:apiv1]
|
||||||
|
|
Loading…
Reference in New Issue