rspec - Best Practices: Testing Chefspecs that use Berkshelf in Jenkins -
i want integrate chefspecs jenkins in way there 1 jenkins job runs specs of cookbooks , prints 1 summary. unfortunately doesn't seem easy have thought. writing simple rakefile creates rspec rake task (like when testing standard ruby specs) won't because rspec expects berksfile in directory called.
so there seem 2 ways test cookbook specs ...
- creating jenkins job each , every cookbook
- iterating manually through cookbooks in jenkins , calling rspec in each cookbook find. not print summary of tests , seems stupid anyway multiple other reasons.
what recommended way here? need create seperate job every cookbook or there better way? in combination berkshelf?
i can see advantages of having job every cookbook's spec means doing git pull dozens of cookbooks same repo. use "all cookbooks in 1 repo"-approach
cheers, stefan
if can re-organize git repositories of cookbooks, try following:
having following directory structure
vagrantfile gemfile berksfile cookbooks/cookbook_a/metadata.rb cookbooks/cookbook_a/recipes/recipe_1.rb cookbooks/cookbook_a/recipes/recipe_2.rb cookbooks/cookbook_b/metadata.rb cookbooks/cookbook_b/recipes/recipe_5.rb cookbooks/cookbook_b/recipes/recipe_6.rb spec/spec_helper.rb spec/cookbook_a/recipe_1_spec.rb spec/cookbook_a/recipe_2_spec.rb spec/cookbook_b/recipe_5_spec.rb spec/cookbook_a/recipe_6_spec.rb
execute following 1 command:
bundle exec rspec spec
this execute chefspec cookbook found under spec/ directory. , jenkins job contains above command.
Comments
Post a Comment