Chef-include and test-kitchen

Perhaps I’m handling this incorrectly, but I have a wrapper cookbook that includes a “role” cookbook using include_recipe. I’m using Berkshelf to manage the dependencies. The wrapper sets attributes for the specific node. I want to use test-kitchen to test this on my local machine and have added the wrapper cookbook to the kitchen yml runlist. When I run converge, I get

 WARN: MissingCookbookDependency:
   Recipe `xxx-client` is not in the run_list, and cookbook 'xxx-client'
   is not a dependency of any cookbook in the run_list.  To load this recipe,
   first add a dependency on cookbook 'xxx-client' in the cookbook you're
   including it from in that cookbook's metadata.

There is a depends statement in the wrapper cookbook’s metadata. Any idea what I’m doing wrong?

Assuming your .kitchen.yml is in the root of your wrapper cookbook and that cookbook’s metadata.rb has a depends on the cookbook with the xxx-client recipie. You want to make sure that you have a Berksfile in the root of your wrapper cookbook. If the dependent cookbook is in the supermarket, the default Berksfile should download it.

Ah, maybe that’s my problem. The dependent cookbook (xxx-client) is a wrapper cookbook I’ve written, essentially a role cookbook wrapping supermarket cookbooks. My idea – perhaps ill-advised – was to have

  • inner cookbook wrapping various supermarket cookbooks into a “role” (in this case, sensu clients)
  • outer cookbook wrapping the inner cookbook, override attributes as needed for the particular node (in this case, sensu client for the San Fran area)

So, tl:dr: a custom cookbook wrapping a custom cookbook wrapping supermarket cookbooks.

Well you can absolutely customize your Berksfile to pull cookbooks from local disk. You just need to tell it where to grab them from. For example,

cookbook 'xxx-client', path: '../xxx-client'

Will pull in the xxx-client cookbook from the specified path relative to the Berksfile.

I double-checked, and I already have the outer cookbook’s Berksfile set up as you described, pointing to the on-disk location of the inner wrapper cookbook (xxx-client). I ran berks update to verify that Berkshelf was pulling in xxx-client correctly, and it worked as expected.


While puttering around on disk using a terminal window, I discovered that my on-disk version of metadata.rb did not have the depends statement – as correctly reported by test-kitchen. Somehow my buffer in emacs showed it as having been written when, in fact, it hadn’t.

My bad. And sorry to have wasted your time. Thanks for the help.