From 93fb5977ae71dbe9f49548539d82ea823c5c2c05 Mon Sep 17 00:00:00 2001 From: vponomaryov Date: Thu, 13 Nov 2014 10:27:38 +0200 Subject: [PATCH] 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 --- contrib/ci/post_test_hook.sh | 49 ++++++++++++++++++++++++++++++++++++ contrib/ci/pre_test_hook.sh | 18 +++++++++++++ manilaclient/config.py | 4 +-- 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 contrib/ci/post_test_hook.sh create mode 100644 contrib/ci/pre_test_hook.sh diff --git a/contrib/ci/post_test_hook.sh b/contrib/ci/post_test_hook.sh new file mode 100644 index 000000000..3a0dcbeb8 --- /dev/null +++ b/contrib/ci/post_test_hook.sh @@ -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 diff --git a/contrib/ci/pre_test_hook.sh b/contrib/ci/pre_test_hook.sh new file mode 100644 index 000000000..41248ef78 --- /dev/null +++ b/contrib/ci/pre_test_hook.sh @@ -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 diff --git a/manilaclient/config.py b/manilaclient/config.py index 5fd591d53..c1cf13fc7 100644 --- a/manilaclient/config.py +++ b/manilaclient/config.py @@ -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' % {