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

View File

@ -86,3 +86,16 @@ uses_debs() {
type "apt-get" 2>/dev/null 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} export PUPPETFILE_DIR=${PUPPETFILE_DIR:-${PUPPET_BASE_PATH}/modules}
source $SCRIPT_DIR/functions source $SCRIPT_DIR/functions
print_header 'Start (install_modules.sh)'
print_header 'Install r10k'
gem install r10k --no-ri --no-rdoc gem install r10k --no-ri --no-rdoc
# make sure there is no puppet module pre-installed # make sure there is no puppet module pre-installed
rm -rf "${PUPPETFILE_DIR:?}/"* rm -rf "${PUPPETFILE_DIR:?}/"*
print_header 'Install Modules'
install_modules install_modules
print_header 'Module List'
puppet 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} export PUPPETFILE_DIR=${PUPPETFILE_DIR:-${PUPPET_BASE_PATH}/modules}
source $SCRIPT_DIR/functions source $SCRIPT_DIR/functions
print_header 'Start (install_modules.sh)'
print_header 'Install Modules'
install_modules install_modules
print_header 'Done (install_modules.sh)'

View File

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