On 9/08/09 20:27, Luke Kanies wrote:
> 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.
I checked the codebase again and I think we're almost covered, since we
have:
* one integration test in the transaction that checks no virtual
resources are applied when the transaction is evaluated (I just need to
check the other cases, like exported/virtual, only exported). This
covers the last part.
* one integration test in the compiler catalog terminus, where we
check that no virtual resource can be leaked to the outside when "finding".
So I'm not all that sure (except adding the various variations of the
exported/virtual flags) that adding a new test (except maybe adding a
collector test to check the resources are not virtual at the end of a
collection) is necessary (and sorry for that long sentence with lots of
parens :-)).
--
Brice Figureau
My Blog: http://www.masterzen.fr/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---