Chapter 11. Chef Zero

Wouldn’t it be nice to be able to spin up a Chef Server locally using a smaller memory footprint than shown in Chapter 9? On many systems, requiring 2 GB of free memory just to simulate a production Chef Server environment is a lot to ask. The Chef Development Kit and Chef Client just so happen to include a stripped-down version of Chef Server for this very purpose, called chef-zero.

chef-zero runs comfortably in as little as 20 MB of memory. Because it is small, it also starts up quickly, which is great for testing. In order to fit into such a small memory footprint, chef-zero sacrifices a few things. There is no web UI, nor is there any persistence; once Chef Zero is stopped, all data is lost. Neither of these two things is needed for testing.

Test Kitchen provides built-in support for chef-zero. Let’s go through a simple example of how you can use chef-zero with Test Kitchen. It’s great for testing your cookbook in a sandbox environment with chef-client using chef-zero as a simulated Chef Server, so you can test cookbooks that exploit Chef Server-specific features. We’ll be covering more of these server-specific features in the remainder of this book, so having a nimbler test environment available will be handy.

Get Learning Chef now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.