summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/application/puppetd.rb5
-rwxr-xr-xspec/unit/configurer.rb32
-rwxr-xr-xspec/unit/resource/catalog.rb10
3 files changed, 35 insertions, 12 deletions
diff --git a/spec/unit/application/puppetd.rb b/spec/unit/application/puppetd.rb
index ec2fd546d..0f7257e59 100755
--- a/spec/unit/application/puppetd.rb
+++ b/spec/unit/application/puppetd.rb
@@ -301,9 +301,8 @@ describe "puppetd" do
@puppetd.run_setup
end
- it "should tell the catalog handler to use REST" do
- Puppet::Resource::Catalog.expects(:terminus_class=).with(:rest)
-
+ it "should change the catalog_terminus setting to 'rest'" do
+ Puppet.expects(:[]=).with(:catalog_terminus, :rest)
@puppetd.run_setup
end
diff --git a/spec/unit/configurer.rb b/spec/unit/configurer.rb
index 4439f3223..df58d5b7e 100755
--- a/spec/unit/configurer.rb
+++ b/spec/unit/configurer.rb
@@ -141,6 +141,9 @@ describe Puppet::Configurer, "when retrieving a catalog" do
@catalog = Puppet::Resource::Catalog.new
+ # this is the default when using a Configurer instance
+ Puppet::Resource::Catalog.indirection.stubs(:terminus_class).returns :rest
+
@agent.stubs(:convert_catalog).returns @catalog
end
@@ -164,6 +167,28 @@ describe Puppet::Configurer, "when retrieving a catalog" do
end
end
+ describe "when not using a REST terminus for catalogs" do
+ it "should not pass any facts when retrieving the catalog" do
+ @agent.expects(:facts_for_uploading).never
+ Puppet::Resource::Catalog.expects(:find).with { |name, options|
+ options[:facts].nil?
+ }.returns @catalog
+
+ @agent.retrieve_catalog
+ end
+ end
+
+ describe "when using a REST terminus for catalogs" do
+ it "should pass the prepared facts and the facts format as arguments when retrieving the catalog" do
+ @agent.expects(:facts_for_uploading).returns(:facts => "myfacts", :facts_format => :foo)
+ Puppet::Resource::Catalog.expects(:find).with { |name, options|
+ options[:facts] == "myfacts" and options[:facts_format] == :foo
+ }.returns @catalog
+
+ @agent.retrieve_catalog
+ end
+ end
+
it "should use the Catalog class to get its catalog" do
Puppet::Resource::Catalog.expects(:find).returns @catalog
@@ -178,13 +203,6 @@ describe Puppet::Configurer, "when retrieving a catalog" do
@agent.retrieve_catalog
end
- it "should pass the prepared facts and the facts format as arguments when retrieving the catalog" do
- @agent.expects(:facts_for_uploading).returns(:facts => "myfacts", :facts_format => :foo)
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:facts] == "myfacts" and options[:facts_format] == :foo }.returns @catalog
-
- @agent.retrieve_catalog
- end
-
it "should default to returning a catalog retrieved directly from the server, skipping the cache" do
Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
diff --git a/spec/unit/resource/catalog.rb b/spec/unit/resource/catalog.rb
index db672438d..ab6aa68be 100755
--- a/spec/unit/resource/catalog.rb
+++ b/spec/unit/resource/catalog.rb
@@ -843,8 +843,14 @@ describe Puppet::Resource::Catalog, "when compiling" do
Puppet::Resource::Catalog.find(:myconfig)
end
- it "should default to the 'compiler' terminus" do
- Puppet::Resource::Catalog.indirection.terminus_class.should == :compiler
+ it "should use the value of the 'catalog_terminus' setting to determine its terminus class" do
+ Puppet.settings[:catalog_terminus] = "rest"
+ Puppet::Resource::Catalog.indirection.terminus_class.should == :rest
+ end
+
+ it "should allow the terminus class to be set manually" do
+ Puppet::Resource::Catalog.indirection.terminus_class = :rest
+ Puppet::Resource::Catalog.indirection.terminus_class.should == :rest
end
after do