diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2011-06-02 16:23:34 -0700 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2011-06-06 15:49:08 -0700 |
| commit | c629958fb45f9ae3581f01835bf89654dd7967b7 (patch) | |
| tree | 959a62362d5fc5e0dd235793c72696d16647c217 /spec/unit | |
| parent | cd4fe148aae923f1167a3db450b64ead87418018 (diff) | |
| download | puppet-c629958fb45f9ae3581f01835bf89654dd7967b7.tar.gz puppet-c629958fb45f9ae3581f01835bf89654dd7967b7.tar.xz puppet-c629958fb45f9ae3581f01835bf89654dd7967b7.zip | |
(#2128) Get facts before retrieving catalog
Retrieving a catalog and getting the facts to submit with the catalog request
are distinct operations, and should be done separately. This is also to prepare
for adding the ability to determine the node name based on a fact, in which
case the node name needs to be determined before it is used for either the
catalog or the report.
Paired-With: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/configurer_spec.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 6c4f9b90a..d454b5fce 100755 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -375,21 +375,21 @@ describe Puppet::Configurer do Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.never - @agent.retrieve_catalog.should == @catalog + @agent.retrieve_catalog({}).should == @catalog end it "should compile a new catalog if none is found in the cache" do Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog - @agent.retrieve_catalog.should == @catalog + @agent.retrieve_catalog({}).should == @catalog end end it "should use the Catalog class to get its catalog" do Puppet::Resource::Catalog.expects(:find).returns @catalog - @agent.retrieve_catalog + @agent.retrieve_catalog({}) end it "should use its node_name_value to retrieve the catalog" do @@ -397,13 +397,13 @@ describe Puppet::Configurer do Puppet.settings[:node_name_value] = "myhost.domain.com" Puppet::Resource::Catalog.expects(:find).with { |name, options| name == "myhost.domain.com" }.returns @catalog - @agent.retrieve_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 - @agent.retrieve_catalog.should == @catalog + @agent.retrieve_catalog({}).should == @catalog end it "should log and return the cached catalog when no catalog can be retrieved from the server" do @@ -412,21 +412,21 @@ describe Puppet::Configurer do Puppet.expects(:notice) - @agent.retrieve_catalog.should == @catalog + @agent.retrieve_catalog({}).should == @catalog end it "should not look in the cache for a catalog if one is returned from the server" do Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.never - @agent.retrieve_catalog.should == @catalog + @agent.retrieve_catalog({}).should == @catalog end it "should return the cached catalog when retrieving the remote catalog throws an exception" do Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.raises "eh" Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog - @agent.retrieve_catalog.should == @catalog + @agent.retrieve_catalog({}).should == @catalog end it "should log and return nil if no catalog can be retrieved from the server and :usecacheonfailure is disabled" do @@ -436,27 +436,27 @@ describe Puppet::Configurer do Puppet.expects(:warning) - @agent.retrieve_catalog.should be_nil + @agent.retrieve_catalog({}).should be_nil end it "should return nil if no cached catalog is available and no catalog can be retrieved from the server" do Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil - @agent.retrieve_catalog.should be_nil + @agent.retrieve_catalog({}).should be_nil end it "should convert the catalog before returning" do Puppet::Resource::Catalog.stubs(:find).returns @catalog @agent.expects(:convert_catalog).with { |cat, dur| cat == @catalog }.returns "converted catalog" - @agent.retrieve_catalog.should == "converted catalog" + @agent.retrieve_catalog({}).should == "converted catalog" end it "should return nil if there is an error while retrieving the catalog" do Puppet::Resource::Catalog.expects(:find).at_least_once.raises "eh" - @agent.retrieve_catalog.should be_nil + @agent.retrieve_catalog({}).should be_nil end end |
