On Aug 8, 2009, at 5:12 AM, Brice Figureau wrote:
>
> On 8/08/09 0:43, Luke Kanies wrote:
>> The patch looks good, but I'd like to see an integration test that
>> covers the problem that occurred in this case -- you've got exported
>> and virtual resources from the client and exported but not virtual
>> resources from other hosts. That should catch any issues we might
>> have here in the future.
>
> Sure, but I really don't see how I could do that in a simple way. Do
> you
> have any ideas I could start with?
Something like:
def resource(desc, exported, virtual)
@dir ||= tempfile("exported_virtual_test")
Dir.mkdir(@dir) unless FileTest.directory?(@dir)
res = Puppet::Parser::Resource.new(:type => :file, :title =>
tmpfile(desc), :params => {:ensure => :present})
res.exported = exported
res.virtual = virtual
@catalog.add_resource res
end
it "should ignore virtual resources but not exported resources" do
@catalog = Puppet::Resource::Catalog.new("myhost")
resource("exported_and_virtual", true, true)
resource("exported_not_virtual", true, false)
resource("virtual_not_exported", false, true)
resource("neither", false, false)
ral = @catalog.to_ral
ral.apply
# make sure the files that should exist do
end
No idea if this will quite work or if it exercises all of the code in
question, but I think it's the basic idea. You could also just create
a manifest that does most of it, add in a collection, and stub that
collection to add in these resources that could act like they were
collected from other hosts.
--
The easiest way for your children to learn about money is for you
not to have any. -- Katharine Whitehorn
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---