On Jul 15, 2011, at 2:57 PM, Tim Sharpe wrote:
> Hi,
>
> I'm looking at setting up some tests for the defined types in my manifests
> (probably using rspec) to test that node <foo> with facts <bar> applying
> define <baz> with params <gronk> creates a catalogue with the following
> resources...
>
> Basically, I want to generate the catalogue for the following and then
> inspect it's contents.
>
> node "foo" {
> baz { 'name':
> test => value,
> }
> }
>
> Looking over Puppet::Node, I can see how to apply classes to a host, but
> nothing about individual resources. If someone could point me in the right
> direction, that'd be greatly appreciated.
Dan Bode has some interesting work here, I think - hopefully he can post it.
In the meantime, I'd probably try something like this:
before do
Puppet[:config] = "/path/to/my/config"
Puppet.settings.parse
@catalog = Puppet::Node::Catalog.indirection.find(Puppet[:certname])
end
it "should create a 'baz' resource" do
@catalog.resource(:baz, "name").should be_instance_of(Puppet::Resource)
end
Something like that, anyway.
--
This space intentionally has nothing but text explaining why this
space has nothing but text explaining that this space would otherwise
have been left blank, and would otherwise have been left blank.
---------------------------------------------------------------------
Luke Kanies | http://puppetlabs.com | http://about.me/lak
Join us in PDX for PuppetConf: http://bit.ly/puppetconfsig
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.