Add gate hook scripts for functional tests

Add gate hook to contrib/ci dir to be able to configure functional tests job.

pre_test_hook just imports devstack extension for manila project to the
devstack project.
post_test_hook configures config file for manilaclient based on devstack
installation and runs related tox job.

Also fix default config file path within config module.

Partially implements bp functional-tests

Change-Id: Ibf90af083b9a8e0ec646e1bff676893528ff1914
This commit is contained in:
vponomaryov 2014-11-13 10:27:38 +02:00 committed by Valeriy Ponomaryov
parent 458888c0d8
commit 93fb5977ae
3 changed files with 69 additions and 2 deletions

View File

@ -0,0 +1,49 @@
#!/bin/bash -xe
#
# 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.
# This script is executed inside post_test_hook function in devstack gate.
export MANILACLIENT_DIR="$BASE/new/python-manilaclient"
export MANILACLIENT_CONF="$MANILACLIENT_DIR/etc/manilaclient/manilaclient.conf"
# Go to the manilaclient dir
cd $MANILACLIENT_DIR
# Give permissions
sudo chown -R jenkins:stack .
# Create manilaclient config file
touch $MANILACLIENT_CONF
# Import 'iniset' func from devstack functions
source $BASE/new/devstack/functions
# Set options to config client.
source $BASE/new/devstack/accrc/demo/demo
iniset $MANILACLIENT_CONF DEFAULT username $OS_USERNAME
iniset $MANILACLIENT_CONF DEFAULT tenant_name $OS_TENANT_NAME
iniset $MANILACLIENT_CONF DEFAULT password $OS_PASSWORD
iniset $MANILACLIENT_CONF DEFAULT auth_url $OS_AUTH_URL
source $BASE/new/devstack/accrc/demo/admin
iniset $MANILACLIENT_CONF DEFAULT admin_username $OS_USERNAME
iniset $MANILACLIENT_CONF DEFAULT admin_tenant_name $OS_TENANT_NAME
iniset $MANILACLIENT_CONF DEFAULT admin_password $OS_PASSWORD
iniset $MANILACLIENT_CONF DEFAULT admin_auth_url $OS_AUTH_URL
# let us control if we die or not
set +o errexit
# Run functional tests
sudo -H -u jenkins tox -e functional

View File

@ -0,0 +1,18 @@
#!/bin/bash -xe
#
# 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.
# This script is executed inside pre_test_hook function in devstack gate.
# Install manila devstack integration
cp -r $BASE/new/manila/contrib/devstack/* $BASE/new/devstack

View File

@ -70,8 +70,8 @@ DEFAULT_CONFIG_FILE = (
'%s.conf' % PROJECT_NAME)
DEFAULT_CONFIG_DIR = (
os.environ.get('OS_%s_CONFIG_DIR' % PROJECT_NAME.upper()) or
os.path.join(os.path.abspath(os.path.dirname(
os.path.dirname(os.path.dirname(__file__)))), "etc/manilaclient")
os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))),
"etc/manilaclient")
)
DEFAULT_CONFIG_PATH = os.path.join(DEFAULT_CONFIG_DIR, DEFAULT_CONFIG_FILE)
FAILOVER_CONFIG_PATH = '/etc/%(pn)s/%(cn)s' % {