Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My team has created a large number of chef cookbooks. I was wondering what methods and frameworks I should look into so we can start creating tests to assure that our nodes are configured properly?

share|improve this question
Sounds like it belongs on ;) – Mark Henderson Aug 11 '11 at 6:19
For a moment I thought you was talking about Chef: – Janne Pikkarainen Aug 11 '11 at 6:23
up vote 7 down vote accepted

You might (also) look into Vagrant for this.
A video is showing how to use the combo of Vagrant and Chef cookbooks. And there's a dedicated page to Vagrant and Chef on the Opscode site (update 2015-01-23: page has gone...).

share|improve this answer

There's the cucumber-chef ruby gem and a recently released book Nelson-Smith et al - "Test-driven Infrastructure with Chef" that makes use of that gem -

Just remembered this from my github watchlist:

The VMTH (Virtual Machine Test Harness) provides a mechanism to unit-test your infrastructure automation - puppet policies, chef recipes, release deployment scripts, etc. It uses features of modern VM monitors (like qemu) to snapshot system state, and then reset that state after each test, so that a series of tests can be performed on a VM instance in rapid succession

share|improve this answer

In my experience, the only way to really do this is with a staging environment and careful development practices. Mocking out the actual work to be done is incredibly messy and fragile, and CI test suites running on commit or push are a lot of effort to write and maintain (although Chef is probably a lot better at this than Puppet, which is my main experience), and take a ridiculous amount of time to run.


Just after I wrote this, I suddenly realised there might be a way to do reasonably efficient "unit" testing of Chef/Puppet recipes with a union filesystem and a significant amount of scaffolding. However, I can't find anything out there that anyone's done already in this area. I might have just found myself a project.

share|improve this answer
Testing the infrastructure itself is incredibly important. Naturally, there are a number of methodologies, i.e, functional and nonfunctional, necessary to implement this slightly differently than software methodologies. – Barry Aug 12 '11 at 8:40

There's a number of options.

Opscode has on the Chef development roadmap "no-op" support which will help with testing. We do argue that "no-op" doesn't necessarily do what you want, but understand the desire for the feature.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.