Puppet module test debug output

This one took hours to find out.

If you are using pdk to run your unit tests, all console output from your module gets squashed. Which is a bit rude, frankly. I could not find anyway of making it print stuff to the console so that I had half a hope of debugging my failing test.

Tha answer in the end was not to use

pdk test unit

But to run the tests with rspec directly. To do this (on Mint):


sudo apt-get install ruby-bundler
sudo bundle install

Then you can


bundle exec rake spec

from the directory which contains your spec folder. You will get different (more) output, and if you use Ruby’s puts you will be able to print to the console.

To keep track of when this gets fixed so that output is retained, follow this issue.

Advertisements