openstack-ansible/scripts/run-tempest.sh
Kevin Carter 255b94d425 Change testr to run in serial
This change implements the change to allow testr to run in serial which
should resolve most issues with tempest on a resource constrained host.

The problem that is being resolved here is that testr will, by default,
run in multi-threaded and has a relitively high probability to result in
a 503. This primarily impacts the gate jobs as they are built on a hosts
with 4 CPUs and 8GB of ram.

By default if the tempest script is run, testr will run multi-threaded.
However, if the environment variable RUN_TEMPEST_OPTS is set to
'--serial' then it will run in serial. This is done for the
gate-check-commit script so that the change only affects the AIO gate
check.

An additional environment variable TESTR_OPTS is added for further
flexibility.

Co-Authored-By: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
Closes-Bug: #1428847
Change-Id: I8c7ac72ef46ae3f3af3d3503081bec0cbe7276e9
2015-03-06 14:48:57 +00:00

51 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2014, Rackspace US, Inc.
#
# 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.
## Shell Opts ----------------------------------------------------------------
set -e -u -v +x
## Vars ----------------------------------------------------------------------
export TEMPEST_SCRIPT_PATH=${TEMPEST_SCRIPT_PATH:-/opt/openstack_tempest_gate.sh}
export TEMPEST_SCRIPT_PARAMETERS=${TEMPEST_SCRIPT_PARAMETERS:-""}
export RUN_TEMPEST_OPTS=${RUN_TEMPEST_OPTS:-''}
export TESTR_OPTS=${TESTR_OPTS:-''}
## Library Check -------------------------------------------------------------
info_block "Checking for required libraries." 2> /dev/null || source $(dirname ${0})/scripts-library.sh
## Main ----------------------------------------------------------------------
info_block "Running OpenStack Smoke Tests"
pushd playbooks
# Check that there are utility containers
if ! ansible 'utility[0]' --list-hosts;then
echo -e "\nERROR: No utility containers have been deployed in your environment\n"
exit_state 99
fi
# Check that the utility container already has the required tempest script deployed
if ! ansible 'utility[0]' -m shell -a "ls -al ${TEMPEST_SCRIPT_PATH}";then
echo -e "\nERROR: Please execute the 'os-tempest-install.yml' playbook prior to this script.\n"
exit_state 99
fi
# Execute the tempest tests
ansible 'utility[0]' -m shell -a "export RUN_TEMPEST_OPTS=${RUN_TEMPEST_OPTS}; \
export TESTR_OPTS=${TESTR_OPTS}; \
${TEMPEST_SCRIPT_PATH} ${TEMPEST_SCRIPT_PARAMETERS}"
popd