Files
49fd5037872bf64d44cd9f59a8f0cd9390fd0323
puppet-openstack-integration /run_tests.sh

229 lines
7.6 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.
export SWAP_SIZE_GB=${SWAP_SIZE_GB:-2}
export MANAGE_HIERA=${MANAGE_HIERA:-true}
export PUPPET_ARGS="${PUPPET_ARGS} --detailed-exitcodes --color=false --test --trace --hiera_config ${HIERA_CONFIG}"
if [ -f /etc/nodepool/provider ]; then
source /etc/nodepool/provider
NODEPOOL_MIRROR_HOST=${NODEPOOL_MIRROR_HOST:-mirror.$NODEPOOL_REGION.$NODEPOOL_CLOUD.openstack.org}
NODEPOOL_MIRROR_HOST=$(echo $NODEPOOL_MIRROR_HOST|tr '[:upper:]' '[:lower:]')
CENTOS_MIRROR_HOST=${NODEPOOL_MIRROR_HOST}
CENTOS_MIRROR_HOST='mirror.centos.org'
export FACTER_centos_mirror_host="http://${CENTOS_MIRROR_HOST}"
export FACTER_ceph_mirror_host="http://${CEPH_MIRROR_HOST}"
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
print_header "Create $SWAP_SIZE_GB GB swapfile"
$SUDO dd if=/dev/zero of=/swapfile count=${SWAP_SIZE_GB}k bs=1M
$SUDO chmod 0600 /swapfile
$SUDO mkswap /swapfile
$SUDO swapon /swapfile
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
/usr/zuul-env/bin/zuul-cloner --workspace /tmp --cache-dir /opt/git \
git://git.openstack.org openstack/tempest-horizon
fi
$SUDO rm -rf /tmp/openstack/tempest
git clone git://git.openstack.org/openstack/tempest /tmp/openstack/tempest
git clone git://git.openstack.org/openstack/tempest-horizon /tmp/openstack/tempest-horizon
fi
# 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
configure_hiera
fi
$SUDO apt-get install -y dstat
$SUDO modprobe br_netfilter
$SUDO yum install -y dstat setools setroubleshoot audit
# use dstat to monitor system activity during integration testing
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"
if [ $RESULT -ne 0 ] && [ $RESULT -ne 2 ]; then
exit 1
fi
set -e
fi
# Run puppet a second time and assert nothing changes.
set +e
set -e
if [ $RESULT -ne 0 ]; then
fi
$SUDO pip install tempest-lib
$SUDO pip install -U testrepository
if uses_debs; then
cd /tmp/openstack/tempest-horizon; $SUDO python setup.py install
fi
# Horizon
# Aodh
# Note: running all Ironic tests under SSL is not working
# https://bugs.launchpad.net/ironic/+bug/1554237
echo "VolumesBackupsAdminV2Test" >> /tmp/openstack/tempest/test-whitelist.txt
run_tempest/bin/pip install -U .
run_tempest/bin/tempest run --whitelist_file=/tmp/openstack/tempest/test-whitelist.txt --concurrency=2
set -e