[chef] How to get test-kitchen to work when cookbook is named "cookbook-x"


Chronological Thread 
  • From: Jay Pipes < >
  • To:
  • Subject: [chef] How to get test-kitchen to work when cookbook is named "cookbook-x"
  • Date: Tue, 13 Nov 2012 17:19:03 -0500

Hi all,

I'm trying to get test-kitchen to work and am running into some issues
that I was hoping to get some help with.

In our organization git repo, we have all our Chef cookbooks in git
repos named "cookbook-X", where X is a project we work on.

For example, we work on the OpenStack Nova project. We have a repo
called github.com:att-cloud/nova that houses our Nova code changes and a
repo called github.com:att-cloud/cookbook-nova that houses our cookbook
for Nova.

The above seems to me to be a very common developer scenario, but
apparently it's not what many tools in the Chef ecosystem are hard-coded
to look for -- namely ChefSpec and test-kitchen.

For ChefSpec, we get around the problem of ChefSpec not being able to
find the cookbook by doing this:

cd $cookbook
mkdir -p cookbooks
ln -s .. cookbooks/$short_name

Where $short_name would be just "nova".

This little hack allows ChefSpec to run properly.

Unfortunately, we can't seem to figure out how to do the same thing with
test-kitchen.

If I run kitchen init && kitchen test in our cookbook-nova root dir,
things look like this:

http://paste.openstack.org/show/25829/

There are a number of Foodcritic failures like this:

FC007: Ensure recipe dependencies are reflected in cookbook metadata:
/home/jpipes/repos/att-cloud/cookbook-nova/recipes/api-ec2.rb:21

Which refer to an include_recipe that refers to a "nova::<recipe>"

If I go into test/kitchen/Kitchenfile and change this line:

cookbook "cookbook-nova" do

to this:

cookbook "nova" do

I get more failures when running kitchen test:

http://paste.openstack.org/show/25830/

How do others get around this problem? I can't imagine that our shop is
the only one that has developers working on projects and cookbooks that
have similar naming conventions... since you can't have the code and the
cookbook repo named the same thing.

Any and all advice most appreciated,
-jay



Archive powered by MHonArc 2.6.16.

§