packstack/run_tests.sh
David Moreau Simard b9fb64af7c Catch packstack execution failures so we can still recover logs
This also prevents an error to occur if installation failed
before tempest was installed

Change-Id: I525cbc2022a455113c900b10f301a6fac52d59f3
2016-01-28 17:07:04 -05:00

83 lines
2.4 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash -ex
# Copyright 2015 Red Hat, 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.
SCENARIO=${SCENARIO:-scenario001}
# We could want to override the default repositories
MANAGE_REPOS=${MANAGE_REPOS:-true}
DELOREAN=${DELOREAN:-http://trunk.rdoproject.org/centos7/current-passed-ci/delorean.repo}
DELOREAN_DEPS=${DELOREAN_DEPS:-http://trunk.rdoproject.org/centos7/delorean-deps.repo}
# If logs should be retrieved automatically
COPY_LOGS=${COPY_LOGS:-true}
if [ $(id -u) != 0 ]; then
# preserve environment so we can have ZUUL_* params
SUDO='sudo -E'
fi
# Setup repositories
if [ "${MANAGE_REPOS}" = true ]; then
$SUDO curl ${DELOREAN} -o /etc/yum.repos.d/delorean.repo
$SUDO curl ${DELOREAN_DEPS} -o /etc/yum.repos.d/delorean-deps.repo
fi
# Install dependencies
$SUDO yum -y install yum-plugin-priorities \
dstat \
python-setuptools \
openssl-devel \
python-devel \
libffi-devel \
libxml2-devel \
libxslt-devel \
ruby-devel \
openstack-selinux \
"@Development Tools"
# Setup dstat for resource usage tracing
if type "dstat" 2>/dev/null; then
$SUDO dstat -tcmndrylpg \
--top-cpu-adv \
--top-io-adv \
--nocolor | $SUDO tee --append /var/log/dstat.log > /dev/null &
fi
# Setup packstack
$SUDO python setup.py install
$SUDO python setup.py install_puppet_modules
# Generate configuration from selected scenario and run it
source ./tests/${SCENARIO}.sh
result=$?
# Generate subunit
if [ -d /var/lib/tempest ]; then
pushd /var/lib/tempest
/var/lib/tempest/.venv/bin/testr last --subunit > /var/tmp/packstack/latest/testrepository.subunit || true
popd
fi
if [ "${COPY_LOGS}" = true ]; then
source ./tools/copy-logs.sh
recover_default_logs
fi
if [ "${FAILURE}" = true ]; then
exit 1
fi
exit $result