Moved to a run_tests runner.

This commit is contained in:
John Dewey 2013-01-29 11:59:11 -08:00
parent 723be6d750
commit 45879c81cc
8 changed files with 107 additions and 37 deletions

8
.gitignore vendored
View File

@ -1,7 +1,3 @@
Cheffile.lock
.bundle
.cache
.rvmrc
*.swp
/cookbooks
/tmp
.cookbooks/
Berkfile.lock

1
Berksfile Normal file
View File

@ -0,0 +1 @@
metadata

9
Berksfile.lock Normal file
View File

@ -0,0 +1,9 @@
cookbook 'openstack-common', :path => '/home/jdewey/git/cookbook-openstack-common'
cookbook 'apt', :locked_version => '1.8.0'
cookbook 'database', :locked_version => '1.3.10'
cookbook 'mysql', :locked_version => '2.1.0'
cookbook 'openssl', :locked_version => '1.0.0'
cookbook 'build-essential', :locked_version => '1.3.2'
cookbook 'postgresql', :locked_version => '2.1.0'
cookbook 'aws', :locked_version => '0.100.6'
cookbook 'xfs', :locked_version => '1.1.0'

View File

@ -1,5 +0,0 @@
#!/usr/bin/env ruby
site "http://community.opscode.com/api/v1"
cookbook "database"

View File

@ -1,6 +1,5 @@
source :rubygems
gem "berkshelf", "~> 1.0.4"
gem "chefspec", "~> 0.9.0"
gem "librarian", "~> 0.0.24"
gem "foodcritic", "~> 1.6.1"
gem "hashie", "~> 1.2.0"

View File

@ -1,10 +1,32 @@
GEM
remote: http://rubygems.org/
specs:
activemodel (3.2.11)
activesupport (= 3.2.11)
builder (~> 3.0.0)
activesupport (3.2.11)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.2)
archive-tar-minitar (0.5.2)
builder (3.1.4)
berkshelf (1.0.4)
activesupport
chef (>= 10.16.2)
chozo (>= 0.2.3)
hashie
minitar
multi_json (>= 1.3.0)
ridley (>= 0.4.1)
solve (>= 0.4.0.rc1)
thor (~> 0.16.0)
vagrant (~> 1.0.5)
yajl-ruby
builder (3.0.4)
bunny (0.7.9)
chef (10.16.2)
celluloid (0.12.4)
facter (>= 1.6.12)
timers (>= 1.0.0)
chef (10.18.2)
bunny (>= 0.6.0, < 0.8.0)
erubis
highline (>= 1.6.9)
@ -14,7 +36,7 @@ GEM
mixlib-config (>= 1.1.2)
mixlib-log (>= 1.3.0)
mixlib-shellout
moneta
moneta (< 0.7.0)
net-ssh (~> 2.2.2)
net-ssh-multi (~> 1.1.0)
ohai (>= 0.6.0)
@ -27,11 +49,21 @@ GEM
erubis
minitest-chef-handler (~> 0.6.0)
rspec (~> 2.11.0)
ci_reporter (1.7.3)
childprocess (0.3.7)
ffi (~> 1.0, >= 1.0.6)
chozo (0.4.2)
activesupport (>= 3.2.0)
hashie
multi_json (>= 1.3.0)
ci_reporter (1.8.4)
builder (>= 2.1.2)
coderay (1.0.8)
diff-lcs (1.1.3)
erubis (2.7.0)
facter (1.6.17)
faraday (0.8.4)
multipart-post (~> 1.1)
ffi (1.3.1)
foodcritic (1.6.1)
erubis
gherkin (~> 2.11.1)
@ -43,30 +75,33 @@ GEM
yajl-ruby (~> 1.1.0)
gherkin (2.11.5)
json (>= 1.4.6)
gist (3.1.0)
gist (3.1.1)
hashie (1.2.0)
highline (1.6.15)
i18n (0.6.1)
ipaddress (0.8.0)
json (1.6.1)
librarian (0.0.25)
archive-tar-minitar (>= 0.5.2)
chef (>= 0.10)
highline
thor (~> 0.15)
json (1.5.4)
log4r (1.1.10)
method_source (0.7.1)
mime-types (1.19)
minitest (4.2.0)
minitest-chef-handler (0.6.3)
minitar (0.5.4)
minitest (4.5.0)
minitest-chef-handler (0.6.5)
chef
ci_reporter
minitest
mixlib-authentication (1.3.0)
mixlib-log
mixlib-cli (1.2.2)
mixlib-cli (1.3.0)
mixlib-config (1.1.2)
mixlib-log (1.4.1)
mixlib-shellout (1.1.0)
moneta (0.6.0)
multi_json (1.5.0)
multipart-post (1.1.5)
net-http-persistent (2.8)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-ssh (2.2.2)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
@ -74,11 +109,12 @@ GEM
net-ssh (>= 2.1.4)
net-ssh-gateway (>= 0.99.0)
nokogiri (1.5.0)
ohai (6.14.0)
ohai (6.16.0)
ipaddress
mixlib-cli
mixlib-config
mixlib-log
mixlib-shellout
systemu
yajl-ruby
polyglot (0.3.3)
@ -89,6 +125,20 @@ GEM
rak (1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
ridley (0.6.3)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
addressable
celluloid
chozo (>= 0.2.2)
erubis
faraday
json (>= 1.5.0)
mixlib-authentication
mixlib-log
multi_json (>= 1.0.4)
net-http-persistent (>= 2.8)
net-ssh
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
@ -98,19 +148,30 @@ GEM
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3)
slop (2.4.4)
solve (0.4.1)
json
systemu (2.5.2)
thor (0.16.0)
timers (1.1.0)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
uuidtools (2.1.3)
vagrant (1.0.6)
archive-tar-minitar (= 0.5.2)
childprocess (~> 0.3.1)
erubis (~> 2.7.0)
i18n (~> 0.6.0)
json (~> 1.5.1)
log4r (~> 1.1.9)
net-scp (~> 1.0.4)
net-ssh (~> 2.2.2)
yajl-ruby (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
berkshelf (~> 1.0.4)
chefspec (~> 0.9.0)
foodcritic (~> 1.6.1)
hashie (~> 1.2.0)
librarian (~> 0.0.24)

View File

@ -143,14 +143,11 @@ in your recipe.
Testing
=====
This cookbook is using [ChefSpec](https://github.com/acrmp/chefspec) for testing.
This cookbook is using [ChefSpec](https://github.com/acrmp/chefspec) for
testing. Should run the following before commiting. It will run your tests,
and check for lint errors.
$ cd $repo
$ bundle
$ librarian-chef install
$ ln -s ../ cookbooks/$short_repo_name # doesn't contain "cookbook-"
$ foodcritic cookbooks/$short_repo_name
$ bundle exec rspec cookbooks/$short_repo_name
% ./run_tests.bash
License and Author
==================

12
run_tests.bash Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
# A script to run tests locally before committing.
set -e
COOKBOOK=$(awk '/^name/ {print $NF}' metadata.rb |tr -d \"\')
bundle install
bundle exec berks install --path .cookbooks
bundle exec foodcritic -f any -t ~FC003 -t ~FC023 .cookbooks/${COOKBOOK}
bundle exec rspec .cookbooks/${COOKBOOK}