Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

test-kitchen won't reference local cookbooks

I'm trying to test a cookbook that depends on three other local cookbooks. My directory structure looks like this:

/cookbooks/
  cookbook_test/
    recipes 
    templates 
    metadata.rb
  cookbook_dep1/
  cookbook_dep2/
  cookbook_dep3/

My metadata file in the cookbook I'm trying to test (cookbook_test) simply has the other three cookbook dependencies mentioned like:

depends cookbook_dep1
depends cookbook_dep2
depends cookbook_dep3

However when running kitchen converge default-ubuntu-1204 I get the following:

[2014-03-03T18:05:13+00:00] ERROR: Cookbook cookbook_devp1 not found. If you're loading cookbook_devp1 from another cookbook, make sure you configure the dependency in your metadata       
[2014-03-03T18:05:13+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)       

The only thing I could find online is that I should be using berkshelf. Is there no other way of referencing local cookbooks with test-kitchen only ?

like image 802
keftes Avatar asked Mar 03 '14 18:03

keftes


People also ask

How does test kitchen work?

A general overview: a test kitchen is a kitchen most often equipped with multiple cooking stations where test cooks and chefs research, test and develop recipes for home cooks. Recipes are often testing multiple times and critiqued by many people.

Which kitchen command will do the following destroy the existing instance create a new instance converge and verify the cookbook and destroy the instance?

The “kitchen test” command is used to fully test the cookbooks in a CI/CD pipeline and is an elaborate process consisting of creating a new instance, converging it, verifying and then destroying the instance.


1 Answers

You have to put the dependencies into a directory named "cookbooks" (or "site-cookbooks") in the same directory where .kitchen.yml is. Or use Berkshelf or Librarian-Chef.

You could also try to just symlink the parent directory into "./cookbooks", but not sure if that would cause infinite recursion for some command.

like image 57
tmatilai Avatar answered Oct 11 '22 16:10

tmatilai