From 2921e36c790dd255b560f322f9444bd6d30be5f6 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Mon, 27 Jul 2015 10:33:28 -0400 Subject: [PATCH] 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 --- .gitignore | 4 ++ Gemfile | 6 +-- run_tests.sh | 42 +++++++++++++++++++ .../install_modules.sh | 18 ++++---- 4 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 .gitignore create mode 100755 run_tests.sh rename install_modules.sh => tools/install_modules.sh (70%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..f789f184f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +Gemfile.lock +.bundle/ +.bundled_gems/ +.modules/ diff --git a/Gemfile b/Gemfile index c61bfe11a..102110189 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" +gem 'r10k' + group :development, :test do gem 'puppetlabs_spec_helper', :require => 'false' gem 'rspec-puppet', '~> 2.2.0', :require => 'false' @@ -18,14 +20,10 @@ end if facterversion = ENV['FACTER_GEM_VERSION'] gem 'facter', facterversion, :require => false -else - gem 'facter', :require => false end if puppetversion = ENV['PUPPET_GEM_VERSION'] gem 'puppet', puppetversion, :require => false -else - gem 'puppet', :require => false end # vim:ft=ruby diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 000000000..d1831d07a --- /dev/null +++ b/run_tests.sh @@ -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 diff --git a/install_modules.sh b/tools/install_modules.sh similarity index 70% rename from install_modules.sh rename to tools/install_modules.sh index 47c57748b..8154c9267 100755 --- a/install_modules.sh +++ b/tools/install_modules.sh @@ -1,19 +1,17 @@ -#!/bin/bash +#!/bin/bash -ex -set -ex - -export SCRIPT_DIR=$(readlink -f "$(dirname $0)") -export PUPPETFILE_DIR=/etc/puppet/modules +export SCRIPT_DIR=$(pwd) +export PUPPETFILE_DIR=${SCRIPT_DIR}/.modules install_external() { - PUPPETFILE=${SCRIPT_DIR}/Puppetfile1 r10k puppetfile install -v + PUPPETFILE=${SCRIPT_DIR}/Puppetfile1 ${GEM_HOME}/bin/r10k puppetfile install -v } install_openstack() { cat > clonemap.yaml <