On Sun, Apr 17, 2011 at 11:07:14PM +0200, Brice Figureau wrote: > On 17/04/11 22:15, Stefan Schulte wrote: > > I'm currently writing an integration test for ssh_authorized_key that > > basically does the following > > > > - write a tempfile with a few dummy lines > > - apply a catalog with one or more resources > > - check the tempfile again > > > > Now I have a failing test and I dont know why it failed. Is there a way > > to see the messages (debug, info etc) that puppet would have printed > > during a normal catalog apply? It would help to see if puppet prefetched > > the file, detected the necessary change and did flush the file again. > > I think you can use a LogCollector as the log destination: > > logs = [] > Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(logs)) > .. log something ... > .. check the content of logs ... > > It's even possible there's such thing in the spec helper. > Checking... > Yes there's one, so it might even be possible to access the logs array > directly in the test (I never tried in fact).
@logs works. Thanks. -Stefan
pgpVb8HdPQKXy.pgp
Description: PGP signature
