#!/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. export PATH=$PATH:/usr/local/sbin:/usr/sbin SCENARIO=${SCENARIO:-scenario001} BRANCH=master # Find OS version and release source /etc/os-release OS_NAME_VERS=${ID}${VERSION_ID} # We could want to override the default repositories or install behavior INSTALL_FROM_SOURCE=${INSTALL_FROM_SOURCE:-true} MANAGE_REPOS=${MANAGE_REPOS:-true} DELOREAN=${DELOREAN:-https://trunk.rdoproject.org/${OS_NAME_VERS}-master/current-passed-ci/delorean.repo} DELOREAN_DEPS=${DELOREAN_DEPS:-https://trunk.rdoproject.org/${OS_NAME_VERS}-master/delorean-deps.repo} GIT_BASE_URL=${GIT_BASE_URL:-https://git.openstack.org} ADDITIONAL_ARGS=${ADDITIONAL_ARGS:-} SELINUX_ENFORCING=${SELINUX_ENFORCING:-true} # If logs should be retrieved automatically COPY_LOGS=${COPY_LOGS:-true} # Let's add an option for a secondary node, to act as a compute CONTROLLER_NODE=${CONTROLLER_NODE:-} COMPUTE_NODE=${COMPUTE_NODE:-} # Use dnf as package manager if it exist type -p dnf && export PKG_MGR=dnf || export PKG_MGR=yum # Install external Puppet modules with r10k # Uses the following variables: # # - ``GEM_BIN_DIR`` must be set to Gem bin directory # - ``PUPPETFILE_DIR`` must be set to Puppet modules directory install_external() { $SUDO ${GEM_BIN_DIR}r10k puppetfile install -v --moduledir ${PUPPETFILE_DIR} --puppetfile Puppetfile1 } # Install Puppet OpenStack modules with zuul-cloner # Uses the following variables: # # - ``PUPPETFILE_DIR`` must be set to Puppet modules directory # - ``ZUUL_REF`` must be set to Zuul ref. Fallback to 'None'. # - ``ZUUL_BRANCH`` must be set to Zuul branch. Fallback to 'master'. install_openstack() { cat > clonemap.yaml < /etc/puppet/puppet.conf < /etc/puppet/hiera.yaml </dev/null; then $SUDO dstat -tcmndrylpg \ --top-cpu-adv \ --top-io-adv \ --nocolor | $SUDO tee -a /var/log/dstat.log > /dev/null & fi # Setup packstack if [ "${INSTALL_FROM_SOURCE}" = true ]; then $SUDO $PIP install -U pip $SUDO $PIP install --ignore-installed -c https://opendev.org/openstack/requirements/raw/branch/$BRANCH/upper-constraints.txt --prefix=/usr . # In Fedora when running with sudo gems are installed at /usr/local/bin/ even when GEM_HOME/GEM_BIN_DIR are set if [ "${PKG_MGR}" = "dnf" ]; then export GEM_BIN_DIR=/usr/local/bin/ else export GEM_BIN_DIR=/tmp/packstackgems/bin/ fi export PUPPETFILE_DIR=/usr/share/openstack-puppet/modules export GEM_HOME=/tmp/packstackgems $SUDO gem install gettext -v 3.2.9 --no-ri --no-rdoc $SUDO gem install r10k -v 2.6.4 --no-ri --no-rdoc # make sure there is no puppet module pre-installed $SUDO rm -rf "${PUPPETFILE_DIR:?}/"* install_modules else $SUDO $PKG_MGR -y install openstack-packstack fi # Make sure there are no other puppet modules in the system (happens in gate) $SUDO rm -rf /etc/puppet/modules/* # Make sure the fqdn is associated to the IP in /etc/hosts # Needed for Horizon SSL tests in Tempest echo -e "\n127.0.0.1 $(facter fqdn)" | $SUDO tee -a /etc/hosts # Generate configuration from selected scenario and run it source ./tests/${SCENARIO}.sh result=$? # Print output and generate subunit if results exist if [ -d /var/lib/tempest ]; then # FIXME(jpena): Work around Fedora image issues with umask $SUDO chown -R $USER /var/lib/tempest pushd /var/lib/tempest if [ -d .testrepository ]; then $SUDO /usr/bin/testr last || true $SUDO bash -c "/usr/bin/testr last --subunit > /var/tmp/packstack/latest/testrepository.subunit" || true elif [ -d .stestr ]; then $SUDO /usr/bin/stestr last || true $SUDO bash -c "/usr/bin/stestr last --subunit > /var/tmp/packstack/latest/testrepository.subunit" || true fi 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