Review: Test-driven Infrastructure with Chef
Test-Driven Infrastructure with Chef by Stephen Nelson-Smith
This slim volume is a good introduction to Chef, with sufficient worked examples to get you up and running with a Chef-powered server fairly quickly. However, the author wants to do more than just teach you Chef: he wants to introduce you to a particular way of thinking about infrastructure, “Infrastructure as Code”.
If services are provisioned by programs, then we can - and should - test those programs. Further, we can write them in a test-driven style: start with the description of how the service should behave, and write a test that expresses this. Then write code that makes that test pass.
Nelson-Smith argues that this and other techniques from the school of Agile software development are of great benefit to systems administrators building modern automated infrastructures. He not only makes a convincing case for test-driven infrastructure development, but has provided a helpful tool for doing it, cucumber-chef, which is introduced in the book with a detailed example.
There is a great deal of debate over which is the best configuration management tool. However, it doesn’t matter which tools you use to build a house if the house subsequently falls down. Nelson-Smith gets this point - the book isn’t called “Chef-Driven Infrastructure with Tests”. His message, with which I wholeheartedly agree, is that we should apply to infrastructure code the lessons learned from the last decade of progress in software development. To that end, his book is both timely and important.