Cookbook dependencies and Test Kitchen

401 views
Skip to first unread message

Testing with Chef

unread,
Apr 23, 2014, 5:40:54 PM4/23/14
to testing-...@googlegroups.com

Re: Scott Carter

I am having some trouble using test-kitchen and I was wondering if you could provide me some pointers. First let me explain where I am at. I have created a custom vagrant box that I have setup and tested separately with vagrant which is working well. I also have a slew of cookbooks that are already written that I am working on. I went into a folder for a specific cookbook that I want to test and performed a "kitchen init" to set everything up. This created my kitchen.yml for me and then I modified it to have my custom platform that I created. I was then able to run "kitchen create" and the VM was started as expected. My problems start when I try to run a "kitchen converge" I am getting the following dependency error because the "connector" cookbook that I am working on depends on other cookbooks. 

[2014-04-23T15:29:45+00:00] ERROR: Cookbook baseos not found. If you're l

oading baseos from another cookbook, make sure you configure the dependency in y
our metadata 

[2014-04-23T15:29:45+00:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)

This is the part that I am confused about because the metadata.rb for this particular cookbook already calls out "baseos" and "va" as dependencies of the connector cookbook. 

name 'connector' 

maintainer 'YOUR_COMPANY_NAME'
maintainer_email 'YOUR_EMAIL'
license 'All rights reserved'
description 'Installs/Configures connector'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends 'baseos'
depends 'va'

What am I doing wrong here?  How can I get test-kitchen to upload all the dependencies as well so that the chef run goes well?  I tried running "kitchen init" from the cookbooks directory but when I did it from that location kitchen could not even find the connector cookbook.  I am stumped here.  Any help would be greatly appreciated.

Thanks,

Scott

Scott Carter

unread,
Apr 23, 2014, 6:06:01 PM4/23/14
to testing-...@googlegroups.com
I was able to solve this one by running the "kitchen init" command from the root of the project instead of within the cookbooks folder or within an individual cookbook.  Since I am not using berkshelf this was the only way I could get it to work since some of our cookbooks depend on others.  I have the dependencies mapped in the metadata.rb for each of our cookbooks so doing the init from the root of the project solved this particular problem.
Reply all
Reply to author
Forward
0 new messages