+1 On Aug 10, 2009, at 11:16 AM, Brice Figureau wrote:
> > Note, I didn't resend the previous patch which was accepted. > This is my attempt to provide more integration tests for this patch. > Let me know if that's enough or not. > > I can also squash both commits if needed (it's not the case atm). > > Thanks, > Brice > > Original commit msg: > Some of the integration tests were either missing or not complete, > especially tests about exported non virtual resources or virtual > and exported resources. > > Signed-off-by: Brice Figureau <[email protected]> > --- > spec/integration/indirector/catalog/compiler.rb | 39 ++++++++++++++ > +++++++-- > spec/integration/transaction.rb | 30 ++++++++++++++ > +++- > 2 files changed, 65 insertions(+), 4 deletions(-) > > diff --git a/spec/integration/indirector/catalog/compiler.rb b/spec/ > integration/indirector/catalog/compiler.rb > index 211b7c2..16102ca 100755 > --- a/spec/integration/indirector/catalog/compiler.rb > +++ b/spec/integration/indirector/catalog/compiler.rb > @@ -11,7 +11,6 @@ describe Puppet::Resource::Catalog::Compiler do > @catalog = Puppet::Resource::Catalog.new > > @one = Puppet::Resource.new(:file, "/one") > - @one.virtual = true > > @two = Puppet::Resource.new(:file, "/two") > @catalog.add_resource(@one, @two) > @@ -19,11 +18,45 @@ describe Puppet::Resource::Catalog::Compiler do > > after { Puppet.settings.clear } > > - it "should remove exported resources when filtering" do > + it "should remove virtual resources when filtering" do > + @one.virtual = true > > Puppet > ::Resource > ::Catalog.indirection.terminus.filter(@catalog).resources.should == > [ @two.ref ] > end > > - it "should filter out exported resources when finding a > catalog" do > + it "should not remove exported resources when filtering" do > + @one.exported = true > + > Puppet > ::Resource > ::Catalog > .indirection.terminus.filter(@catalog).resources.sort.should == > [ @one.ref, @two.ref ] > + end > + > + it "should remove virtual exported resources when filtering" do > + @one.exported = true > + @one.virtual = true > + > Puppet > ::Resource > ::Catalog.indirection.terminus.filter(@catalog).resources.should == > [ @two.ref ] > + end > + > + it "should filter out virtual resources when finding a catalog" > do > + @one.virtual = true > + request = stub 'request', :name => "mynode" > + > Puppet > ::Resource > ::Catalog.indirection.terminus.stubs(:extract_facts_from_request) > + > Puppet > ::Resource::Catalog.indirection.terminus.stubs(:node_from_request) > + > Puppet > ::Resource > ::Catalog.indirection.terminus.stubs(:compile).returns(@catalog) > + > + Puppet::Resource::Catalog.find(request).resources.should == > [ @two.ref ] > + end > + > + it "should not filter out exported resources when finding a > catalog" do > + @one.exported = true > + request = stub 'request', :name => "mynode" > + > Puppet > ::Resource > ::Catalog.indirection.terminus.stubs(:extract_facts_from_request) > + > Puppet > ::Resource::Catalog.indirection.terminus.stubs(:node_from_request) > + > Puppet > ::Resource > ::Catalog.indirection.terminus.stubs(:compile).returns(@catalog) > + > + > Puppet::Resource::Catalog.find(request).resources.sort.should == > [ @one.ref, @two.ref ] > + end > + > + it "should filter out virtual exported resources when finding a > catalog" do > + @one.exported = true > + @one.virtual = true > request = stub 'request', :name => "mynode" > > Puppet > ::Resource > ::Catalog.indirection.terminus.stubs(:extract_facts_from_request) > > Puppet > ::Resource::Catalog.indirection.terminus.stubs(:node_from_request) > diff --git a/spec/integration/transaction.rb b/spec/integration/ > transaction.rb > index 2b8a5d9..7ab852b 100755 > --- a/spec/integration/transaction.rb > +++ b/spec/integration/transaction.rb > @@ -23,10 +23,37 @@ describe Puppet::Transaction do > transaction.evaluate > end > > - it "should not apply exported resources" do > + it "should not apply virtual resources" do > + catalog = Puppet::Resource::Catalog.new > + resource = Puppet::Type.type(:file).new :path => "/foo/ > bar", :backup => false > + resource.virtual = true > + catalog.add_resource resource > + > + transaction = Puppet::Transaction.new(catalog) > + > + resource.expects(:evaluate).never > + > + transaction.evaluate > + end > + > + it "should apply exported resources" do > + catalog = Puppet::Resource::Catalog.new > + resource = Puppet::Type.type(:file).new :path => "/foo/ > bar", :backup => false > + resource.exported = true > + catalog.add_resource resource > + > + transaction = Puppet::Transaction.new(catalog) > + > + resource.expects(:evaluate).never > + > + transaction.evaluate > + end > + > + it "should not apply virtual exported resources" do > catalog = Puppet::Resource::Catalog.new > resource = Puppet::Type.type(:file).new :path => "/foo/ > bar", :backup => false > resource.exported = true > + resource.virtual = true > catalog.add_resource resource > > transaction = Puppet::Transaction.new(catalog) > @@ -35,4 +62,5 @@ describe Puppet::Transaction do > > transaction.evaluate > end > + > end > -- > 1.6.0.2 > > > > -- If you would be a real seeker after truth, it is necessary that at least once in your life you doubt, as far as possible, all things. -- Rene Descartes --------------------------------------------------------------------- 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 -~----------~----~----~----~------~----~------~--~---
