Merge "Setup gate test scripts for Octavia"

This commit is contained in:
Jenkins 2016-09-20 18:57:53 +00:00 committed by Gerrit Code Review
commit f84adbba73
4 changed files with 253 additions and 35 deletions

View File

@ -0,0 +1,63 @@
#!/bin/bash
# This file is meant to be sourced by the other hooks
# Legacy values for $1, $2 and $3:
# $1 - dsvm-functional, tempest (testtype)
# $2 - lbaasv2, lbaasv1 (octaviaversion)
# $3 - scenario, minimal, api, healthmonitor, listener, loadbalancer, member, pool (octaviatest)
# Args being phased in:
# $1 - same
# $2 - same
# $3 - test-driver, with any missing -driver being "octavia"
# scenario-octavia
# minimal-octavia
# api-namespace
# api-{thirdparty}
# healthmonitor-octavia
# listener-octavia
# loadbalancer-octavia
# member-octavia
# pool-octavia
testtype="$1"
octaviaversion="$2"
octaviatest="$3"
case $testtype in
"dsvm-functional")
testenv=$testtype
;;
"tempest")
lbaasenv=$(echo "$octaviatest" | perl -ne '/^(.*)-([^-]+)$/ && print "$1";')
if [ -z "$lbaasenv" ]; then
lbaasenv=$octaviatest
fi
lbaasdriver=$(echo "$octaviatest" | perl -ne '/^(.*)-([^-]+)$/ && print "$2";')
if [ -z "$lbaasdriver" ]; then
lbaasdriver='octavia'
fi
testenv=${octaviatest:-"apiv1"}
if [ "$octaviaversion" = "v1" ]; then
case "$lbaasenv" in
"api"|"healthmonitor"|"listener"|"loadbalancer"|"member"|"minimal"|"pool")
testenv="apiv1"
;;
"scenario")
testenv="scenario"
;;
*)
echo "Unrecognized env $lbaasenv".
exit 1
;;
esac
fi
;;
esac

View File

@ -0,0 +1,105 @@
#!/bin/bash
set -ex
GATE_DEST=$BASE/new
DEVSTACK_PATH=$GATE_DEST/devstack
export DEVSTACK_LOCAL_CONFIG+="
enable_plugin barbican https://git.openstack.org/openstack/barbican
"
# Sort out our gate args
. $(dirname "$0")/decode_args.sh
if egrep --quiet '(vmx|svm)' /proc/cpuinfo; then
export DEVSTACK_GATE_LIBVIRT_TYPE=kvm
fi
function _setup_octavia {
export DEVSTACK_LOCAL_CONFIG+="
enable_plugin octavia https://git.openstack.org/openstack/octavia
"
if [ "$testenv" != "apiv1" ]; then
ENABLED_SERVICES+="octavia,o-cw,o-hk,o-hm,o-api,"
fi
if [ "$testenv" = "apiv1" ]; then
cat > "$DEVSTACK_PATH/local.conf" <<EOF
[[post-config|/etc/octavia/octavia.conf]]
[DEFAULT]
debug = True
[controller_worker]
amphora_driver = amphora_noop_driver
compute_driver = compute_noop_driver
network_driver = network_noop_driver
EOF
fi
if [ "$testenv" = "scenario" ]; then
cat > "$DEVSTACK_PATH/local.conf" <<EOF
[[post-config|/etc/octavia/octavia.conf]]
[DEFAULT]
debug = True
EOF
fi
}
case "$testtype" in
"dsvm-functional")
PROJECT_NAME=octavia
OCTAVIA_PATH=$GATE_DEST/$PROJECT_NAME
DEVSTACK_PATH=$GATE_DEST/devstack
IS_GATE=True
USE_CONSTRAINT_ENV=False
export LOG_COLOR=False
source "$OCTAVIA"/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")
# These are not needed with either v1 or v2
ENABLED_SERVICES+="-c-api,-c-bak,-c-sch,-c-vol,-cinder,"
ENABLED_SERVICES+="-s-account,-s-container,-s-object,-s-proxy,"
if [ "$testenv" != "scenario" ]; then
export DEVSTACK_LOCAL_CONFIG+="
DISABLE_AMP_IMAGE_BUILD=True
"
# Not needed for API tests
ENABLED_SERVICES+="-horizon,-ceilometer-acentral,-ceilometer-acompute,"
ENABLED_SERVICES+="-ceilometer-alarm-evaluator,-ceilometer-alarm-notifier,"
ENABLED_SERVICES+="-ceilometer-anotification,-ceilometer-api,"
ENABLED_SERVICES+="-ceilometer-collector,"
fi
if [ "$lbaasdriver" = "namespace" ]; then
export DEVSTACK_LOCAL_CONFIG+="
NEUTRON_LBAAS_SERVICE_PROVIDERV2=LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
"
fi
if [ "$lbaasdriver" = "octavia" ]; then
_setup_octavia
fi
export ENABLED_SERVICES
"$GATE_DEST"/devstack-gate/devstack-vm-gate.sh
;;
*)
echo "Unrecognized test type $testtype".
exit 1
;;
esac

View File

@ -0,0 +1,85 @@
#!/bin/bash
set -xe
TEMPEST_CONFIG_DIR="$BASE/new/tempest/etc"
SCRIPTS_DIR="/usr/os-testr-env/bin"
OCTAVIA_DIR="$BASE/new/octavia"
# Sort out our gate args
. $(dirname "$0")/decode_args.sh
if [ "$testenv" = "apiv1" ]; then
case "$lbaasenv" in
minimal)
# Temporarily just do the happy path
test_subset="octavia.tests.tempest.v2.api.test_load_balancers_non_admin.LoadBalancersTestJSON.test_create_load_balancer(?!_) "
test_subset+="octavia.tests.tempest.v2.api.test_load_balancers_non_admin.LoadBalancersTestJSON.test_get_load_balancer_stats(?!_) "
test_subset+="octavia.tests.tempest.v2.api.test_load_balancers_non_admin.LoadBalancersTestJSON.test_get_load_balancer_status_tree(?!_) "
test_subset+="octavia.tests.tempest.v2.api.test_listeners_non_admin.ListenersTestJSON.test_create_listener(?!_) "
test_subset+="octavia.tests.tempest.v2.api.test_pools_non_admin.TestPools.test_create_pool(?!_) "
test_subset+="octavia.tests.tempest.v2.api.test_members_non_admin.MemberTestJSON.test_add_member(?!_) "
test_subset+="octavia.tests.tempest.v2.api.test_health_monitors_non_admin.TestHealthMonitors.test_create_health_monitor(?!_)"
;;
healthmonitor)
test_subset="health_monitor"
;;
listener)
test_subset="listeners"
;;
loadbalancer)
test_subset="load_balancers"
;;
member)
test_subset="members"
;;
pool)
test_subset="pools"
;;
scenario)
testenv="scenario"
;;
esac
fi
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/"$testenv"/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
}
case $testtype in
"dsvm-functional")
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.
cd "$OCTAVIA_DIR"
sudo chown -R $owner:stack "$OCTAVIA_DIR"
# Run tests
echo "Running Octavia $testenv test suite"
set +e
sudo -H -u $owner $sudo_env tox -e $testenv -- $test_subset
testr_exit_code=$?
set -e
# Collect and parse results
generate_testr_results
exit $testr_exit_code

View File

@ -1,35 +0,0 @@
#!/bin/bash
set -ex
GATE_DEST=$BASE/new
DEVSTACK_PATH=$GATE_DEST/devstack
export DEVSTACK_LOCAL_CONFIG+="
enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas
enable_plugin barbican https://git.openstack.org/openstack/barbican
enable_plugin octavia https://git.openstack.org/openstack/octavia"
# Below projects are required for setting up environment
case $PROJECTS in
*openstack/barbican* )
;;
* )
export PROJECTS="openstack/barbican $PROJECTS"
export PROJECTS="openstack/python-barbicanclient $PROJECTS"
;;
esac
# These are not needed for api and scenario tests
ENABLED_SERVICES+="-c-api,-c-bak,-c-sch,-c-vol,-cinder"
ENABLED_SERVICES+=",-s-account,-s-container,-s-object,-s-proxy"
# Disable lbaasv1 and enable lbaasv2
ENABLED_SERVICES+="q-lbaasv2,-q-lbaas,octavia,o-cw,o-hk,o-hm,o-api"
export ENABLED_SERVICES
#REGEX is required for running octavia specific tempest tests
export DEVSTACK_GATE_TEMPEST_REGEX="^octavia\."
$GATE_DEST/devstack-gate/devstack-vm-gate.sh