Course Description
The most important role of a Cookbook developer is to test a code before it enters production. This course will focus on testing Chef cookbooks consistently and effectively.
Learning Objectives
Test-driven Development
- start the course
- use Behavior-Driven Development (BDD) in the context of Chef cookbook development
- identify the Chef Development Kit tools used for unit and integration testing
- generate unit and integration tests inside of a cookbook
Integration Testing
- list the components of the .kitchen.yml file
- configure a Test Kitchen driver to support deploying to physical, virtual, or cloud machines
- execute the chef-client on a virtual machine generated by Test Kitchen
- define an integration test and verify the results with kitchen login
- use the InSpec compliance language to write simple integration tests
- refactor a recipe and run kitchen verify with a test-driven approach
Unit Testing
- execute the RSpec utility to test Chef recipes in memory
- utilize a simple formula to write ChefSpec tests
- configure the Pry Ruby gem to insert a breakpoint into a recipe
- use ChefSpec to check case statement evaluation of node attributes
Practice: Build a Multi-Platform Cookbook
- use Test Kitchen to verify a simple Apache cookbook on Ubuntu and Centos