Search code examples
chef-infraberkshelftest-kitchen

Chef: Kitchen Converge cannot find local cookbook dependency


I have 2 local cookbooks. One is called golang_app and the other is called test_go_web_app. test_go_web_app depends on golang_app and runs golang_app::default by doing include_recipe 'golang_app::default' in its default.rb....

I am trying to add golang_app as test_go_web_app's dependency... Right now, test_go_web_app's Berksfile looks like:

source 'https://supermarket.chef.io'

cookbook 'golang_app', path: '../golang_app'

metadata

However, when running kitchen converge, I am getting:

Chef::Exceptions::CookbookNotFound
   ----------------------------------
   Cookbook golang_app not found. If you're loading golang_app from another cookbook, make sure you configure the dependency in your metadata

   Cookbook Trace:
   ---------------
     /tmp/kitchen/cache/cookbooks/test_go_web_app/recipes/default.rb:1:in `from_file'

   Relevant File Content:
   ----------------------
   /tmp/kitchen/cache/cookbooks/test_go_web_app/recipes/default.rb:

     1>> include_recipe 'golang_app::default'
     2:

Has anyone been able to get this to work?


Solution

  • In addition to the Berksfile line, you also need to add depends 'golang_app' to the metadata.rb for test_go_web_app. Also make sure the Berksfile is right next to the Kitchen config file in your folder structure.