Initial run_tests.sh script

When launching run_tests.sh we need to make sure to call
install_modules.sh.

I've moved it into the tools directory, and installed the modules
local vs global. This is mostly personal preference but avoids puppet
modules conflicts with global /etc/puppet folder.

Change-Id: I77c445a71720e0c8dd4744777c2bc6a0a6663590
Depends-On: I87c12faffab953ad2039d2b9ed9ab420e97ab2b7
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-07-27 10:33:28 -04:00
parent a8c1ba9a46
commit 2921e36c79
4 changed files with 55 additions and 15 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
Gemfile.lock
.bundle/
.bundled_gems/
.modules/

View File

@ -1,5 +1,7 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org" source ENV['GEM_SOURCE'] || "https://rubygems.org"
gem 'r10k'
group :development, :test do group :development, :test do
gem 'puppetlabs_spec_helper', :require => 'false' gem 'puppetlabs_spec_helper', :require => 'false'
gem 'rspec-puppet', '~> 2.2.0', :require => 'false' gem 'rspec-puppet', '~> 2.2.0', :require => 'false'
@ -18,14 +20,10 @@ end
if facterversion = ENV['FACTER_GEM_VERSION'] if facterversion = ENV['FACTER_GEM_VERSION']
gem 'facter', facterversion, :require => false gem 'facter', facterversion, :require => false
else
gem 'facter', :require => false
end end
if puppetversion = ENV['PUPPET_GEM_VERSION'] if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
end end
# vim:ft=ruby # vim:ft=ruby

42
run_tests.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash -e
# 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.
if [ -z $GEM_HOME ]; then
echo "Warning! \$GEM_HOME is not set"
echo ""
echo "In order to properly run the integration tests, please run the"
echo "following:"
echo ""
echo " $ export GEM_HOME=\`pwd\`/.bundled_gems"
exit 1
fi
if ! [ -f $GEM_HOME ]; then
mkdir -p $GEM_HOME
fi
BUNDLE=${GEM_HOME}/bin/bundle
if ! [ -f ${BUNDLE} ]; then
echo "Warning! bundler is not installed"
echo ""
echo "Please run the following to install bundler:"
echo " $ gem install bundler"
exit 1
fi
${BUNDLE} install --no-color --without development test system_tests
./tools/install_modules.sh

View File

@ -1,19 +1,17 @@
#!/bin/bash #!/bin/bash -ex
set -ex export SCRIPT_DIR=$(pwd)
export PUPPETFILE_DIR=${SCRIPT_DIR}/.modules
export SCRIPT_DIR=$(readlink -f "$(dirname $0)")
export PUPPETFILE_DIR=/etc/puppet/modules
install_external() { install_external() {
PUPPETFILE=${SCRIPT_DIR}/Puppetfile1 r10k puppetfile install -v PUPPETFILE=${SCRIPT_DIR}/Puppetfile1 ${GEM_HOME}/bin/r10k puppetfile install -v
} }
install_openstack() { install_openstack() {
cat > clonemap.yaml <<EOF cat > clonemap.yaml <<EOF
clonemap: clonemap:
- name: '(.*?)/puppet-(.*)' - name: '(.*?)/puppet-(.*)'
dest: '/etc/puppet/modules/\2' dest: '$PUPPETFILE_DIR/\2'
EOF EOF
local project_names=$(awk '{ if ($1 == ":git") print $3 }' \ local project_names=$(awk '{ if ($1 == ":git") print $3 }' \
@ -28,11 +26,9 @@ EOF
} }
install_all() { install_all() {
PUPPETFILE=${SCRIPT_DIR}/Puppetfile r10k puppetfile install -v PUPPETFILE=${SCRIPT_DIR}/Puppetfile ${GEM_HOME}/bin/r10k puppetfile install -v
} }
gem install r10k --no-ri --no-rdoc
# If zuul-cloner is there, have it install modules using zuul refs # If zuul-cloner is there, have it install modules using zuul refs
if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then
csplit ${SCRIPT_DIR}/Puppetfile /'External modules'/ \ csplit ${SCRIPT_DIR}/Puppetfile /'External modules'/ \
@ -44,4 +40,4 @@ else
install_all install_all
fi fi
puppet module list puppet module list --color=false