Speedup ChefSpec when cookbook(s) have dependencies in their metadata.rb on gems (chef_gem)


(1) An example illustrates the current observed behavior:

  • In a wrapper cookbook, add a dependency to cookbook chef-vault: depends 'chef-vault', '~> 3.0'
  • This cookbook in turn adds a dependency in it’s metadata.rb on gem 'chef-vault'
  • Add a few unit tests and run them (I am using Berkshelf to resolve the dependencies)
  • Observe that for each defined runner the chef-vault gem is pulled from rubygems.org

Problem: this greatly slows down the unit tests. Some cookbooks take more then 4 minutes to complete the unit tests.

(2) Work around:

(3) Questions:

  • Did I do something wrong that brought me into the observed situation (1)?
  • If not, is there a better solution to solve this issue then (2)?
  • If (2) seems to be the only work around, what would be the things to look out for when applying this work around in wrapper cookbooks that have this issue?

Thank you for your help!