Firstly, forgive me if I get my terminology mixed up. Being sold on
the virtues of TDD, I have a growing itch to test our puppet
manifests. Now by this I dont mean testing, say, the mechanics of a
define to test that the right things *happen*, I mean being able to
say that given a collection of classes and parameters for a node, the
following resources should be created and the relationship between
them should be xyz.
How would I go about this? Is it a case of generating a catalog from
the manifest, parsing that and then making assertions on the result?
Does puppet already have a framework or API to enable this sort of
testing?
Some pseudo code to perhaps explain what I''d like to achieve:
c = generate_catalog(
classes=[''foo'', ''bar''],
parameters={
''a'':1,
''b'':2
}),
assertEqual(
c.resources.get("File[''/foo/bar/baz'']").mode,
777,
)
assertTrue(c.resources.get("File[''/foo/bar/baz'']").parent
is
c.resources.get("File[''/foo/bar'']"))
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
On Fri, Feb 25, 2011 at 9:24 AM, Darren Worrall <dw@darrenworrall.co.uk>wrote:> Firstly, forgive me if I get my terminology mixed up. Being sold on > the virtues of TDD, I have a growing itch to test our puppet > manifests. Now by this I dont mean testing, say, the mechanics of a > define to test that the right things *happen*, I mean being able to > say that given a collection of classes and parameters for a node, the > following resources should be created and the relationship between > them should be xyz. > > How would I go about this? Is it a case of generating a catalog from > the manifest, parsing that and then making assertions on the result? > Does puppet already have a framework or API to enable this sort of > testing? >this is what cucumber-puppet does. https://github.com/nistude/cucumber-puppet> > Some pseudo code to perhaps explain what I''d like to achieve: > > c = generate_catalog( > classes=[''foo'', ''bar''], > parameters={ > ''a'':1, > ''b'':2 > }), > > assertEqual( > c.resources.get("File[''/foo/bar/baz'']").mode, > 777, > ) > assertTrue(c.resources.get("File[''/foo/bar/baz'']").parent is > c.resources.get("File[''/foo/bar'']")) > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Feb 25, 4:24 pm, Dan Bode <d...@puppetlabs.com> wrote:> this is what cucumber-puppet does. > > https://github.com/nistude/cucumber-puppetI''ll second cucumber-puppet. Being able to verify catalog compilation is a great step. Beyond that you can test resources for the catalogs as well. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.