rspec testing and viewing the catalogue it is testing

297 views
Skip to first unread message

choffee

unread,
May 7, 2014, 8:38:22 AM5/7/14
to puppet...@googlegroups.com
I am trying to debug why my test is failing and not producing a file that I thought it should be.

Is there a simple way to view the catalogue that rspec is testing against?

I tried --debug in the .rspec file with the debugger gem and it gives no extra errors is there something more I need to add to my test to turn it on?

Thanks

john

choffee

unread,
May 7, 2014, 10:42:29 AM5/7/14
to puppet...@googlegroups.com
Am I doing this wrong?

I create a test that says "check for a file named foo", write some code that should create the file. It fails for whatever reason and the test just says no.

How do I get a clue what I am doing wrong? It seems obvious to me that having the catalog that was tested against for that test would mean I could see my error rather than having to guess and test again.

john

Denmat

unread,
May 7, 2014, 6:21:06 PM5/7/14
to puppet...@googlegroups.com
Hi,

You need to include the puppet logging in you rspec file.

I can't remember what that is off the top of my head but I'm pretty sure this will help you along the way.


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/e743953c-6175-4193-a620-1456d84ac84d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Felix Frank

unread,
May 8, 2014, 4:42:39 AM5/8/14
to puppet...@googlegroups.com
Hi,

can you share a sample manifest and spec test that expose this problem?
I do not yet clearly understand what you're trying to do.

Thanks,
Felix

choffee

unread,
May 8, 2014, 10:33:58 AM5/8/14
to puppet...@googlegroups.com
That seems to be it. Thanks. I thought I had tried that yesterday but it gave no more output.

john

choffee

unread,
May 8, 2014, 10:44:34 AM5/8/14
to puppet...@googlegroups.com
Hi Felix,

I think I have this sorted now with the log level stuff that denmat suggested.

Basically it was a typo in my test but my point was I could not get to see the catalogue that my test was testing against.

Puppet file:

concat::fragment{'foo':
path => '/etc/foo',
content => 'set some values',
}

Test file:

should contain_concat__fragment("foo")

The first time I ran it I missed the double underscore in the test. But there was no way that I could see if my catalogue contained that fragment.

But by adding the logging stuff above I can now see all the parts of the catalogue and how it's built and so debug the problem quicker. Shame there is not a simple flag to turn this on for failing tests though.

john


Reply all
Reply to author
Forward
0 new messages