Testing your puppet manifests with rspec-puppet
It would be great if we could verify that our Puppet manifests satisfy certain expectations without even having to run Puppet. The rspec-puppet
tool is a nifty tool to do this. Based on RSpec, a testing framework for Ruby programs, rspec-puppet
lets you write test cases for your Puppet manifests that are especially useful to catch regressions (bugs introduced when fixing another bug), and refactoring problems (bugs introduced when reorganizing your code).
Getting ready
Here's what you'll need to do to install rspec-puppet
.
Run the following commands:
t@mylaptop~ $ sudo puppet resource package rspec-puppet ensure=installed provider=gem Notice: /Package[rspec-puppet]/ensure: created package { 'rspec-puppet': ...
Get Puppet Cookbook - Third Edition 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.