Gate migration tests: Add Cinder tempest hook
This patch is part of the effort to add migration tests to OpenStack gate. It will rely in 2 tempest tests that are on the dependency list and that the gate job will configure the following backends: ceph nfs glusterfs lvm. Once running, the script will configure 2 tempest backends and run the migration tests on all possible combinations of the backend listed above. The output of the test run will be something like: ceph nfs ceph --- SUCCESS nfs SUCCESS --- If all tests in the matrix result in SUCCESS, then the test script returns. Otherwise, other value is returned and the job is marked as failed. Depends-on: I4ed9b1f30d4e4e595c44a0ce243c2463069833d7 Depends-on: Iff4d880a0f8e928cbc07b84ff0c357ad59ef929c Change-Id: I17b5cd9dafb3ad17e8721376ae1e6790bd93108c
This commit is contained in:
parent
808862bf37
commit
4f5a5962fa
4
tools/hooks/README
Normal file
4
tools/hooks/README
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
These are hooks to be used by the OpenStack infra test system. These scripts
|
||||||
|
may be called by certain jobs at important times to do extra testing, setup,
|
||||||
|
etc. They are really only relevant within the scope of the OpenStack infra
|
||||||
|
system and are not expected to be useful to anyone else.
|
99
tools/hooks/run_multi_backend_matrix.sh
Executable file
99
tools/hooks/run_multi_backend_matrix.sh
Executable file
@ -0,0 +1,99 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (c) 2016, Hitachi, Erlon Cruz <erlon.cruz@fit-tecnologia.org.br>
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# 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 -x
|
||||||
|
export TEMPEST_USER=${TEMPEST_USER:-tempest}
|
||||||
|
chmod +w $BASE/new/tempest
|
||||||
|
cd $BASE/new/tempest
|
||||||
|
source $BASE/new/devstack/functions
|
||||||
|
source $BASE/new/devstack/functions-common
|
||||||
|
source $WORKSPACE/devstack-gate/functions.sh
|
||||||
|
source $BASE/new/cinder/tools/hooks/utils.sh
|
||||||
|
export TEMPEST_CONFIG=$BASE/new/tempest/etc/tempest.conf
|
||||||
|
|
||||||
|
# Disable bash verbose so we have a cleaner output. Also, exit on error must
|
||||||
|
# be disable as we will run several tests that can return error.
|
||||||
|
set +x +e
|
||||||
|
|
||||||
|
function configure_tempest_backends {
|
||||||
|
be1=$1
|
||||||
|
be2=$2
|
||||||
|
echo "Configuring tempest conf in ${TEMPEST_CONFIG}"
|
||||||
|
# TODO(erlon): Call iniset using sudo
|
||||||
|
#sudo -HE -u ${TEMPEST_USER} iniset $TEMPEST_CONFIG 'volume' \
|
||||||
|
#'backend_names' ${be1},${be2}
|
||||||
|
iniset $TEMPEST_CONFIG 'volume' 'backend_names' ${be1},${be2}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BACKENDS='lvm ceph nfs'
|
||||||
|
# NOTE(erlon): Skipping test_volume_migrate_attached while bug #1644214 is not
|
||||||
|
# fixed.
|
||||||
|
RGEX="(.*test_volume_retype_with_migration.*)"
|
||||||
|
final_result=0
|
||||||
|
final_message='Migrations tests finished SUCCESSFULLY!'
|
||||||
|
declare -A TEST_RESULTS
|
||||||
|
start_time=`date +%s`
|
||||||
|
for be1 in ${BACKENDS}; do
|
||||||
|
for be2 in ${BACKENDS}; do
|
||||||
|
if [ ${be1} != ${be2} ]; then
|
||||||
|
configure_tempest_backends ${be1} ${be2}
|
||||||
|
echo "============================================================"
|
||||||
|
echo "Testing multibackend features: ${be1} vs ${be2}"
|
||||||
|
echo "============================================================"
|
||||||
|
run_tempest "${be1} vs ${be2}" ${RGEX}
|
||||||
|
result=$?
|
||||||
|
# If any of the test fail, we keep running but return failure as
|
||||||
|
# the final result
|
||||||
|
if [ ${result} -ne 0 ]; then
|
||||||
|
TEST_RESULTS[${be1},${be2}]="FAILURE"
|
||||||
|
final_message='Migrations tests FAILED!'
|
||||||
|
final_result=1
|
||||||
|
else
|
||||||
|
TEST_RESULTS[${be1},${be2}]="SUCCESS"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
end_time=`date +%s`
|
||||||
|
elapsed=$(expr $(expr ${end_time} - ${start_time}) / 60)
|
||||||
|
|
||||||
|
# Print the results
|
||||||
|
num_rows=$(echo $BACKENDS | wc -w)
|
||||||
|
fmt=" %15s"
|
||||||
|
echo "============================================================"
|
||||||
|
echo " ${final_message} In ${elapsed} minutes."
|
||||||
|
echo "============================================================"
|
||||||
|
|
||||||
|
printf "$fmt" ''
|
||||||
|
for be1 in ${BACKENDS}; do
|
||||||
|
printf "$fmt" ${be1}
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
for be1 in ${BACKENDS}; do
|
||||||
|
printf "$fmt" ${be1}
|
||||||
|
for be2 in ${BACKENDS}; do
|
||||||
|
if [ ${be1} == ${be2} ]; then
|
||||||
|
printf "$fmt" '---'
|
||||||
|
else
|
||||||
|
printf "$fmt" ${TEST_RESULTS[${be1},${be2}]}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
exit ${final_result}
|
10
tools/hooks/utils.sh
Executable file
10
tools/hooks/utils.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function run_tempest {
|
||||||
|
local message=$1
|
||||||
|
local tempest_regex=$2
|
||||||
|
sudo -H -u ${TEMPEST_USER} tox -eall -- $tempest_regex \
|
||||||
|
--concurrency=${TEMPEST_CONCURRENCY}
|
||||||
|
exitcode=$?
|
||||||
|
return ${exitcode}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user