Files
b639ec24a8fa30a11a76cac2da9d2f322837503f
puppet-openstack-integration /run_tests.sh

227 lines
7.4 KiB
Bash
Raw Normal View History

#
# 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.
if [ $PUPPET_VERSION == 4 ]; then
export PATH=${PATH}:/opt/puppetlabs/bin
export PUPPET_RELEASE_FILE=puppetlabs-release-pc1
export PUPPET_BASE_PATH=/etc/puppetlabs/code
export PUPPET_PKG=puppet-agent
else
export PUPPET_RELEASE_FILE=puppetlabs-release
export PUPPET_BASE_PATH=/etc/puppet
export PUPPET_PKG=puppet
fi
source ${SCRIPT_DIR}/functions
if [ ! -f fixtures/${SCENARIO}.pp ]; then
echo "fixtures/${SCENARIO}.pp file does not exist. Please define a valid scenario."
exit 1
fi
# preserve environment so we can have ZUUL_* params
SUDO='sudo -E'
fi
# can clone tempest outside of the gate. Also, tempest should be sandboxed into
# the local directory but works needs to be added into puppet to properly find
# the path.
if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then
/usr/zuul-env/bin/zuul-cloner --workspace /tmp --cache-dir /opt/git \
git://git.openstack.org openstack/tempest
$SUDO rm -rf /tmp/openstack/tempest
git clone git://git.openstack.org/openstack/tempest /tmp/openstack/tempest
# - trusty: puppet3 and puppet4
# - xenial: puppet4 only
if [[ ${DISTRO} == "trusty" ]] || [[ ${DISTRO} == "xenial" && ${PUPPET_VERSION} == 4 ]]; then
if dpkg -l $PUPPET_RELEASE_FILE >/dev/null 2>&1; then
$SUDO apt-get purge -y $PUPPET_RELEASE_FILE
fi
$SUDO rm -f /tmp/puppet.deb
wget http://apt.puppetlabs.com/${PUPPET_RELEASE_FILE}-${DISTRO}.deb -O /tmp/puppet.deb
$SUDO dpkg -i /tmp/puppet.deb
# TODO(emilien): figure what installed /etc/default/puppet on the xenial nodepool image
# We have no problem on Trusty but on Xenial we need to remove /etc/default/puppet before
# trying to deploy puppet-agent from puppetlabs.com.
$SUDO rm -rf /etc/default/puppet
$SUDO rpm -e $PUPPET_RELEASE_FILE
if rpm --quiet -q epel-release; then
$SUDO rpm -e epel-release
fi
$SUDO service auditd start
# SElinux in permissive mode so later we can catch alerts
$SUDO setenforce 0
PUPPET_ARGS="${PUPPET_ARGS} --detailed-exitcodes --color=false --test --trace"
PUPPET_FULL_PATH=$(which puppet)
function run_puppet() {
local manifest=1ドル
$SUDO $PUPPET_FULL_PATH apply $PUPPET_ARGS fixtures/${manifest}.pp
local res=$?
return $res
}
if is_fedora; then
$SUDO sealert -a /var/log/audit/audit.log
# https://bugzilla.redhat.com/show_bug.cgi?id=1341738
if $SUDO grep -iqE 'denied.*system_r:rabbitmq_t' /var/log/audit/audit.log; then
echo "non-critical RabbitMQ AVC, ignoring it now."
else
echo "Please file a bug on https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20OpenStack&component=openstack-selinux showing sealert output."
exit 1
fi
echo 'No AVC detected in /var/log/audit/audit.log'
fi
fi
}
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 &
$SUDO ./install_modules.sh
fi
set +e
$SUDO $PUPPET_FULL_PATH apply $PUPPET_ARGS -e "include ::openstack_integration::repos"
set -e
if [ $RESULT -ne 2 ]; then
fi
# Run puppet a second time and assert nothing changes.
set +e
set -e
if [ $RESULT -ne 0 ]; then
fi
$SUDO rm -f /tmp/openstack/tempest/cirros-0.3.4-x86_64-disk.img
# exists.
if [ -f ~/cache/files/cirros-0.3.4-x86_64-disk.img ]; then
# Create a symlink for tempest.
ln -s ~/cache/files/cirros-0.3.4-x86_64-disk.img /tmp/openstack/tempest
else
wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img -P /tmp/openstack/tempest
fi
$SUDO pip install tempest-lib
# https://bugzilla.redhat.com/show_bug.cgi?id=1252812
$SUDO pip install gabbi
TESTS="smoke"
# Horizon
# Aodh
TESTS="${TESTS} TelemetryAlarming"
# Ironic
# Note: running all Ironic tests under SSL is not working
# https://bugs.launchpad.net/ironic/+bug/1554237
TESTS="${TESTS} api.baremetal.admin.test_drivers"
TESTS="${TESTS} TestManageQueue"
tox -eall-plugin -- --concurrency=2 $TESTS
set -e