It's probably better to just update the storeconfigs hook in defaults.rb to accept a false value and reset the settings when set to false.
But this is acceptable, too, since the whole thing is a bit hackish. On May 1, 2009, at 1:33 PM, Brice Figureau wrote: > > All the snippets tests were failing because some parser and scope > tests activated storeconfigs without reseting the state. > Activating storeconfigs is not undoable at the moment by just > setting storeconfig=false as some terminus are changed. > > Signed-off-by: Brice Figureau <[email protected]> > --- > test/language/parser.rb | 18 ++++++++++++++++++ > test/language/scope.rb | 7 +++++++ > 2 files changed, 25 insertions(+), 0 deletions(-) > > diff --git a/test/language/parser.rb b/test/language/parser.rb > index 30baea4..7794c42 100755 > --- a/test/language/parser.rb > +++ b/test/language/parser.rb > @@ -444,6 +444,9 @@ file { "/tmp/yayness": > def test_virtualresources > tests = [:virtual] > if Puppet.features.rails? > + catalog_cache_class = > Puppet::Resource::Catalog.indirection.cache_class > + facts_cache_class = > Puppet::Node::Facts.indirection.cache_class > + node_cache_class = Puppet::Node.indirection.cache_class > Puppet[:storeconfigs] = true > tests << :exported > end > @@ -496,11 +499,20 @@ file { "/tmp/yayness": > check.call(res, "multiresource") > end > end > + if Puppet.features.rails? > + Puppet[:storeconfigs] = false > + Puppet::Resource::Catalog.cache_class = > catalog_cache_class > + Puppet::Node::Facts.cache_class = facts_cache_class > + Puppet::Node.cache_class = node_cache_class > + end > end > > def test_collections > tests = [:virtual] > if Puppet.features.rails? > + catalog_cache_class = > Puppet::Resource::Catalog.indirection.cache_class > + facts_cache_class = > Puppet::Node::Facts.indirection.cache_class > + node_cache_class = Puppet::Node.indirection.cache_class > Puppet[:storeconfigs] = true > tests << :exported > end > @@ -523,6 +535,12 @@ file { "/tmp/yayness": > assert_instance_of(AST::Collection, coll) > assert_equal(form, coll.form) > end > + if Puppet.features.rails? > + Puppet[:storeconfigs] = false > + Puppet::Resource::Catalog.cache_class = > catalog_cache_class > + Puppet::Node::Facts.cache_class = facts_cache_class > + Puppet::Node.cache_class = node_cache_class > + end > end > > def test_collectionexpressions > diff --git a/test/language/scope.rb b/test/language/scope.rb > index 77af950..32e1802 100755 > --- a/test/language/scope.rb > +++ b/test/language/scope.rb > @@ -409,6 +409,9 @@ class TestScope < Test::Unit::TestCase > # run, whether it's in the same scope as a collection or a > different > # scope. > def test_storeandcollect > + catalog_cache_class = > Puppet::Resource::Catalog.indirection.cache_class > + facts_cache_class = > Puppet::Node::Facts.indirection.cache_class > + node_cache_class = Puppet::Node.indirection.cache_class > Puppet[:storeconfigs] = true > Puppet::Rails.init > sleep 1 > @@ -442,6 +445,10 @@ Host <<||>>" > assert(flat.find{|o| o.name == name }, "Did not find > #{name}") > end > } > + Puppet[:storeconfigs] = false > + Puppet::Resource::Catalog.cache_class = catalog_cache_class > + Puppet::Node::Facts.cache_class = facts_cache_class > + Puppet::Node.cache_class = node_cache_class > end > else > $stderr.puts "No ActiveRecord -- skipping collection tests" > -- > 1.6.0.2 > > > > -- Susskind's Rule of Thumb: Don't ask what they think. Ask what they do. --------------------------------------------------------------------- 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 -~----------~----~----~----~------~----~------~--~---
