use Strainer for test runs

also removed old run_tests.bash script and added tailor requirement
needed by our default Strainerfile

Change-Id: I5e835cde469c0933d31dcdd68d55543cd87fa80f
This commit is contained in:
Ionuț Arțăriși 2013-07-24 14:30:26 +02:00
parent ad90a7669b
commit ee8e02b3e0
5 changed files with 28 additions and 26 deletions

View File

@ -8,4 +8,4 @@ gem "chefspec", "~> 1.3.0"
gem "foodcritic"
gem "strainer"
gem "webmock", "~> 1.11.0"
gem "tailor"

View File

@ -94,6 +94,7 @@ GEM
ipaddress (0.8.0)
json (1.7.7)
little-plugger (1.1.3)
log_switch (0.4.0)
logging (1.6.2)
little-plugger (>= 1.1.3)
mime-types (1.23)
@ -176,8 +177,16 @@ GEM
strainer (3.0.4)
berkshelf (~> 2.0)
systemu (2.5.2)
tailor (1.2.1)
log_switch (>= 0.3.0)
term-ansicolor (>= 1.0.5)
text-table (>= 1.2.2)
term-ansicolor (1.2.2)
tins (~> 0.8)
text-table (1.2.3)
thor (0.18.1)
timers (1.1.0)
tins (0.8.2)
treetop (1.4.14)
polyglot
polyglot (>= 0.3.1)
@ -210,4 +219,5 @@ DEPENDENCIES
foodcritic
json (<= 1.7.7)
strainer
tailor
webmock (~> 1.11.0)

View File

@ -61,8 +61,18 @@ Templates
* `quantum.conf.erb` - Config file for OpenStack Network server
* `policy.json.erb` - Configuration of ACLs for glance API server
License and Author
==================
Testing
=======
This cookbook uses [bundler](http://gembundler.com/), [berkshelf](http://berkshelf.com/), and [strainer](https://github.com/customink/strainer) to isolate dependencies and run tests.
Tests are defined in Strainerfile.
To run tests:
$ bundle install # install gem dependencies
$ bundle exec berks install # install cookbook dependencies
$ bundle exec strainer test # run tests
License and Author
==================

5
Strainerfile Normal file
View File

@ -0,0 +1,5 @@
# Strainerfile
tailor: bundle exec tailor
knife test: bundle exec knife cookbook test $COOKBOOK
foodcritic: bundle exec foodcritic -f any -t ~FC003 -t ~FC023 $SANDBOX/$COOKBOOK
chefspec: bundle exec rspec $SANDBOX/$COOKBOOK/spec

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
# A script to run tests locally before committing.
set -e
COOKBOOK=$(awk '/^name/ {print $NF}' metadata.rb |tr -d \"\')
if [ -z $COOKBOOK ]; then
echo "Cookbook name not defined in metadata.rb"
    exit 1
fi
BUNDLE_PATH=${BUNDLE_PATH:-.bundle}
BERKSHELF_PATH=${BERKSHELF_PATH:-.cookbooks}
echo "Using bundle path: $BUNDLE_PATH"
echo "Using berkshelf path: $BERKSHELF_PATH"
bundle install --path=${BUNDLE_PATH}
bundle exec berks install --path=${BERKSHELF_PATH}
bundle exec rspec ${BERKSHELF_PATH}/${COOKBOOK}
bundle exec foodcritic -f any -t ~FC003 -t ~FC023 ${BERKSHELF_PATH}/${COOKBOOK}