I recently migrated a client away from Andrew Cunningham’s puppet-validator – an open source project that simply compiles catalogs based on configurable fact values – to rspec-puppet.
The advantages of rspec-puppet are many and, obviously, being able to do more than just compile catalogs is one advantage. However, Andrew’s project also had some advantages; in particular it used threads to parallelise catalog compilation. This meant that some 100 catalogs could be compiled and tested on my 8 CPU-core laptop in less than 3 minutes. After setting up rspec-puppet, however, I found that the same tests were now taking over 20 minutes.
It seems to me that the Puppet community has thus far tolerated rspec-puppet’s slowness. To illustrate, I’ll focus in this post on the very mature Puppet Labs Apache module and show how parallelising its rspec-puppet tests by setting up Michael Grosser’s parallel_tests would get the current execution time of about 30 minutes (on my laptop) down to under three.
Running the rspec tests in puppetlabs/apache
To get started, let’s clone the puppetlabs/apache module:
$ cd /tmp $ git clone https://github.com/puppetlabs/puppetlabs-apache.git