summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-03-31 17:34:16 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit913b63cddfaed68605aa3341010b0aa53c9870a5 (patch)
treebcdc70d641f20f04f7569dec62438bab89273784
parenta228399fb921eabd635bddd92b63d86ee3c26d2c (diff)
downloadpuppet-913b63cddfaed68605aa3341010b0aa53c9870a5.tar.gz
puppet-913b63cddfaed68605aa3341010b0aa53c9870a5.tar.xz
puppet-913b63cddfaed68605aa3341010b0aa53c9870a5.zip
Bug #3451: Don't leak the terminus class setting from Puppet::Resource::Catalog's spec
This issue causes other specs to fail, because they depend on the default terminus being unchanged.
-rw-r--r--lib/puppet/indirector/indirection.rb4
-rwxr-xr-xspec/unit/resource/catalog.rb8
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb
index 35f17768e..06aa19077 100644
--- a/lib/puppet/indirector/indirection.rb
+++ b/lib/puppet/indirector/indirection.rb
@@ -145,6 +145,10 @@ class Puppet::Indirector::Indirection
@terminus_class
end
+ def reset_terminus_class
+ @terminus_class = nil
+ end
+
# Specify the terminus class to use.
def terminus_class=(klass)
validate_terminus_class(klass)
diff --git a/spec/unit/resource/catalog.rb b/spec/unit/resource/catalog.rb
index 853bf9bee..afa98fa35 100755
--- a/spec/unit/resource/catalog.rb
+++ b/spec/unit/resource/catalog.rb
@@ -819,6 +819,8 @@ describe Puppet::Resource::Catalog, "when compiling" do
describe "when indirecting" do
before do
+ @real_indirection = Puppet::Resource::Catalog.indirection
+
@indirection = stub 'indirection', :name => :catalog
Puppet::Util::Cacher.expire
@@ -831,6 +833,11 @@ describe Puppet::Resource::Catalog, "when compiling" do
end
it "should use the value of the 'catalog_terminus' setting to determine its terminus class" do
+ # Puppet only checks the terminus setting the first time you ask
+ # so this returns the object to the clean state
+ # at the expense of making this test less pure
+ Puppet::Resource::Catalog.indirection.reset_terminus_class
+
Puppet.settings[:catalog_terminus] = "rest"
Puppet::Resource::Catalog.indirection.terminus_class.should == :rest
end
@@ -842,6 +849,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
after do
Puppet::Util::Cacher.expire
+ @real_indirection.reset_terminus_class
end
end