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.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s