Merge "Add a function for generating action headers"

This commit is contained in:
Jenkins 2016-04-18 18:03:37 +00:00 committed by Gerrit Code Review
commit 86b6b1f3c0
5 changed files with 47 additions and 2 deletions

View File

@ -47,18 +47,23 @@ export SCENARIO=scenario-aio
export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
source $SCRIPT_DIR/functions
print_header 'Start (all-in-one.sh)'
if is_fedora; then
print_header 'Setup (RedHat based)'
sudo yum -y remove facter puppet rdo-release
sudo yum -y install libxml2-devel libxslt-devel ruby-devel rubygems wget
sudo yum -y groupinstall "Development Tools"
DASHBOARD="dashboard"
elif uses_debs; then
print_header 'Setup (Debian based)'
sudo apt-get remove -y --purge facter puppet puppet-common
sudo apt-get update
sudo apt-get install -y libxml2-dev libxslt-dev zlib1g-dev ruby wget
DASHBOARD="horizon"
fi
print_header 'Install Bundler'
mkdir -p .bundled_gems
export GEM_HOME=`pwd`/.bundled_gems
gem install bundler --no-rdoc --no-ri --verbose
@ -72,6 +77,7 @@ if [ $RESULT -ne 0 ]; then
exit 1
fi
print_header 'Setup openrc'
cat > ~/openrc <<EOF
export OS_PROJECT_DOMAIN_ID=default
export OS_USER_DOMAIN_ID=default
@ -92,3 +98,4 @@ To use OpenStack through the CLI, run:
source ~/openrc
EOF
print_header 'Done (all-in-one.sh)'

View File

@ -86,3 +86,16 @@ uses_debs() {
type "apt-get" 2>/dev/null
}
print_header() {
if [ -n "$(set | grep xtrace)" ]; then
set +x
local enable_xtrace='yes'
fi
local msg=$1
printf '%.0s-' {1..80}; echo
printf '| %-76s |\n' "${msg}"
printf '%.0s-' {1..80}; echo
if [ -n "${enable_xtrace}" ]; then
set -x
fi
}

View File

@ -17,11 +17,17 @@ export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
export PUPPETFILE_DIR=${PUPPETFILE_DIR:-${PUPPET_BASE_PATH}/modules}
source $SCRIPT_DIR/functions
print_header 'Start (install_modules.sh)'
print_header 'Install r10k'
gem install r10k --no-ri --no-rdoc
# make sure there is no puppet module pre-installed
rm -rf "${PUPPETFILE_DIR:?}/"*
print_header 'Install Modules'
install_modules
print_header 'Module List'
puppet module list
print_header 'Done (install_modules.sh)'

View File

@ -20,4 +20,9 @@ export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
export PUPPETFILE_DIR=${PUPPETFILE_DIR:-${PUPPET_BASE_PATH}/modules}
source $SCRIPT_DIR/functions
print_header 'Start (install_modules.sh)'
print_header 'Install Modules'
install_modules
print_header 'Done (install_modules.sh)'

View File

@ -32,6 +32,7 @@ else
fi
source ${SCRIPT_DIR}/functions
print_header 'Start (run_tests.sh)'
if [ ! -f fixtures/${SCENARIO}.pp ]; then
echo "fixtures/${SCENARIO}.pp file does not exist. Please define a valid scenario."
@ -43,6 +44,7 @@ if [ $(id -u) != 0 ]; then
SUDO='sudo -E'
fi
print_header 'Clone Tempest'
# TODO(pabelanger): Move this into tools/install_tempest.sh and add logic so we
# 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
@ -59,6 +61,7 @@ else
fi
if uses_debs; then
print_header 'Setup (Debian based)'
if dpkg -l $PUPPET_RELEASE_FILE >/dev/null 2>&1; then
$SUDO apt-get purge -y $PUPPET_RELEASE_FILE
fi
@ -69,6 +72,7 @@ if uses_debs; then
$SUDO apt-get update
$SUDO apt-get install -y dstat ${PUPPET_PKG}
elif is_fedora; then
print_header 'Setup (RedHat based)'
# TODO(emilien): this is a workaround until this patch is merged:
# https://review.openstack.org/#/c/304399/
# strip down to en_* locales
@ -128,6 +132,7 @@ function catch_selinux_alerts() {
# use dstat to monitor system activity during integration testing
if type "dstat" 2>/dev/null; then
print_header 'Start dstat'
$SUDO dstat -tcmndrylpg --top-cpu-adv --top-io-adv --nocolor | $SUDO tee --append /var/log/dstat.log > /dev/null &
fi
@ -138,26 +143,32 @@ fi
# Run puppet and assert something changes.
set +e
if [ "${MANAGE_REPOS}" = true ]; then
print_header 'Install repos'
$SUDO $PUPPET_FULL_PATH apply $PUPPET_ARGS -e "include ::openstack_integration::repos"
fi
print_header "Running Puppet Scenario: ${SCENARIO} (1st time)"
run_puppet $SCENARIO
RESULT=$?
set -e
if [ $RESULT -ne 2 ]; then
print_header 'SELinux Alerts (1st time)'
catch_selinux_alerts
exit 1
fi
# Run puppet a second time and assert nothing changes.
set +e
print_header "Running Puppet Scenario: ${SCENARIO} (2nd time)"
run_puppet $SCENARIO
RESULT=$?
set -e
if [ $RESULT -ne 0 ]; then
print_header 'SELinux Alerts (2nd time)'
catch_selinux_alerts
exit 1
fi
print_header 'Prepare Tempest'
mkdir -p /tmp/openstack/tempest
$SUDO rm -f /tmp/openstack/tempest/cirros-0.3.4-x86_64-disk.img
@ -187,6 +198,7 @@ TESTS="${TESTS} api.baremetal.admin.test_drivers"
# Zaqar
TESTS="${TESTS} TestManageQueue"
print_header 'Running Tempest'
cd /tmp/openstack/tempest
tox -eall-plugin -- --concurrency=2 $TESTS
RESULT=$?
@ -194,6 +206,8 @@ set -e
testr last --subunit > /tmp/openstack/tempest/testrepository.subunit
/tmp/openstack/tempest/.tox/all-plugin/bin/tempest list-plugins
print_header 'SELinux Alerts (Tempest)'
catch_selinux_alerts
print_header 'Done (run_tests.sh)'
exit $RESULT