- Explain why the post – job required, growing pains, need for stability and health of the repo
- Why to test
- What to test
- How to test Lint – Rake file Parser – rake file with globbing to run easier Rspec – spec type tests to run on puppet code (syntax mainly) Beaker – run tests on provisioned VM to ensure correct
Cover:
puppet-lint puppet parser validate <manifest.pp> puppet-rspec – A gem that runs rspec unit tests on a module (Based on compiled catalog) Beaker
Part of my role at work is managing a fleet of robots, servers, and other infrastructure responsible for running our business. Due to the nature of our business, we run within customer warehouses.
Being a one man operation, one of my main concerns is keeping all the systems stable and proper working conditions. I am not the only developer touching our puppet code, but I’m the one responsible for the system(s).
As I embarked on the journey to add reliability to our infrastructure, something very clear came up: there’s a lot of information about testing puppet, but most of it is fractured, out of date, or hard to understand. See this slideshow from 2016 about the state of testing puppet.
I’m writing this post up to act as a handbook of sorts for testing puppet, as well as a ‘repository’ for testing puppet.
Testing resources
- Puppet-lint – Useful for linting your puppet code
- Rspec Puppet – Rspec tests for puppet code
- Puppet: module smoke testing
- Slideshow about all things puppet
- Extending Puppet – Second Edition
- Beaker
- Getting Started Puppet Acceptance Tests With Beaker
- Great example of testing – Puppet MySQL module
- Puppetlabs Spec Helper
- Puppet Cookbook – Simple Syntax Check
- Testing Puppet