summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-03-31 17:34:16 -0700
committerJames Turnbull <james@lovedthanlost.net>2010-05-02 17:38:19 +1000
commit5abe571e167744ac198960c8e35c699375ec5cf7 (patch)
tree695d8b75d7940fd5f81b56b8cb1fc8db6d9d248c
parentebd924c22c1049cde5f110c6ec89de4d9358b649 (diff)
downloadpuppet-5abe571e167744ac198960c8e35c699375ec5cf7.tar.gz
puppet-5abe571e167744ac198960c8e35c699375ec5cf7.tar.xz
puppet-5abe571e167744ac198960c8e35c699375ec5cf7.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 dc7e58f36..7c3183396 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 ab6aa68be..73c327367 100755
--- a/spec/unit/resource/catalog.rb
+++ b/spec/unit/resource/catalog.rb
@@ -832,6 +832,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
@@ -844,6 +846,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
@@ -855,6 +862,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
after do
Puppet::Util::Cacher.expire
+ @real_indirection.reset_terminus_class
end
end