Newbie questions regarding Berks and Test-Kitchen

I’ve been dabbling with testing some chef cookbooks and have a few questions regarding best practices.

Question 1:
For testing cookbooks, I notice many people use test-kitchen. Fortunately I have a lab CHEF server to play with and VMs that I can test bootstrapping with in a cloud environment (i.e. AWS). Is there any benefits to using test-kitchen when I can simply bootstrap to a node/VM and see if the recipe worked? Why should I use test kitchen?

Question 2:
I’ve been using berks to download dependencies and upload cookbooks to the CHEF server. Is this common practice? Is there another way to do it? I don’t have an issue using berks, but I’m wondering if it’s an industry standard or are there other preferred ways of downloading/uploading dependencies to the CHEF server.

Thanks,

Jon

Hi,

In your situation you would use test-kitchen with a suitable cloud driver (eg ec2 [1]). The benefit of using test-kitchen is to automate cookbook testing. The cloud driver will take care of provisioning an environment, uploading chef code, converging and then running tests (eg inspec). For me, I use the docker driver to test a cookbook in a docker container that looks like a centos VM.

Berkshelf is standard practice for dealing with cookbook dependencies and upload. You can says it’s equivalent to npm for node.js modules.

  1. https://github.com/test-kitchen/kitchen-ec2

Q1. It is still much faster to create/converge using TK than bootstraping. I’m using the EC2 driver and using TK ables me to concentrate on the code.