diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2010-11-23 16:42:06 -0800 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2010-11-23 16:42:06 -0800 |
| commit | 4b35402ba85d8842d757becec5c8a7bf4d6f6654 (patch) | |
| tree | 5da174c4c1c106b99e8c464e45e89d7b5ba2b5a2 /spec/unit/application | |
| parent | a7bd1630622cace01d0e4c974c76366e4b3b886c (diff) | |
| parent | 2bc6727b6ac7348dbac98099f1fe0aeb3cd1295f (diff) | |
| download | puppet-4b35402ba85d8842d757becec5c8a7bf4d6f6654.tar.gz puppet-4b35402ba85d8842d757becec5c8a7bf4d6f6654.tar.xz puppet-4b35402ba85d8842d757becec5c8a7bf4d6f6654.zip | |
Merge branch 'next'
Diffstat (limited to 'spec/unit/application')
| -rwxr-xr-x | spec/unit/application/agent_spec.rb | 7 | ||||
| -rwxr-xr-x | spec/unit/application/apply_spec.rb | 31 | ||||
| -rw-r--r-- | spec/unit/application/filebucket_spec.rb | 1 | ||||
| -rwxr-xr-x | spec/unit/application/queue_spec.rb | 1 |
4 files changed, 32 insertions, 8 deletions
diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb index 8fc98b8c1..50ef00c57 100755 --- a/spec/unit/application/agent_spec.rb +++ b/spec/unit/application/agent_spec.rb @@ -180,6 +180,7 @@ describe Puppet::Application::Agent do Puppet[:libdir] = "/dev/null/lib" Puppet::SSL::Host.stubs(:ca_location=) Puppet::Transaction::Report.stubs(:terminus_class=) + Puppet::Transaction::Report.stubs(:cache_class=) Puppet::Resource::Catalog.stubs(:terminus_class=) Puppet::Resource::Catalog.stubs(:cache_class=) Puppet::Node::Facts.stubs(:terminus_class=) @@ -311,6 +312,12 @@ describe Puppet::Application::Agent do @puppetd.setup end + it "should tell the report handler to cache locally as yaml" do + Puppet::Transaction::Report.expects(:cache_class=).with(:yaml) + + @puppetd.setup + end + it "should change the catalog_terminus setting to 'rest'" do Puppet[:catalog_terminus] = :foo @puppetd.setup diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb index edb41b5c3..f07416378 100755 --- a/spec/unit/application/apply_spec.rb +++ b/spec/unit/application/apply_spec.rb @@ -4,6 +4,7 @@ require File.dirname(__FILE__) + '/../../spec_helper' require 'puppet/application/apply' require 'puppet/file_bucket/dipper' +require 'puppet/configurer' describe Puppet::Application::Apply do before :each do @@ -56,6 +57,7 @@ describe Puppet::Application::Apply do Puppet.stubs(:parse_config) Puppet::FileBucket::Dipper.stubs(:new) STDIN.stubs(:read) + Puppet::Transaction::Report.stubs(:cache_class=) @apply.options.stubs(:[]).with(any_parameters) end @@ -113,6 +115,11 @@ describe Puppet::Application::Apply do lambda { @apply.setup }.should raise_error(SystemExit) end + it "should tell the report handler to cache locally as yaml" do + Puppet::Transaction::Report.expects(:cache_class=).with(:yaml) + + @apply.setup + end end describe "when executing" do @@ -193,6 +200,9 @@ describe Puppet::Application::Apply do @catalog.stubs(:apply).returns(@transaction) @apply.stubs(:exit) + + Puppet::Util::Storage.stubs(:load) + Puppet::Configurer.any_instance.stubs(:save_last_run_summary) # to prevent it from trying to write files end it "should set the code to run from --code" do @@ -301,27 +311,32 @@ describe Puppet::Application::Apply do end it "should call the prerun and postrun commands on a Configurer instance" do - configurer = stub 'configurer' - - Puppet::Configurer.expects(:new).returns configurer - configurer.expects(:execute_prerun_command) - configurer.expects(:execute_postrun_command) + Puppet::Configurer.any_instance.expects(:execute_prerun_command) + Puppet::Configurer.any_instance.expects(:execute_postrun_command) @apply.main end it "should apply the catalog" do - @catalog.expects(:apply).returns(stub_everything 'transaction') + @catalog.expects(:apply).returns(stub_everything('transaction')) @apply.main end + it "should save the last run summary" do + Puppet.stubs(:[]).with(:noop).returns(false) + report = stub 'report' + Puppet::Configurer.any_instance.stubs(:initialize_report).returns(report) + + Puppet::Configurer.any_instance.expects(:save_last_run_summary).with(report) + @apply.main + end + describe "with detailed_exitcodes" do it "should exit with report's computed exit status" do Puppet.stubs(:[]).with(:noop).returns(false) @apply.options.stubs(:[]).with(:detailed_exitcodes).returns(true) - report = stub 'report', :exit_status => 666 - @transaction.stubs(:report).returns(report) + Puppet::Transaction::Report.any_instance.stubs(:exit_status).returns(666) @apply.expects(:exit).with(666) @apply.main diff --git a/spec/unit/application/filebucket_spec.rb b/spec/unit/application/filebucket_spec.rb index 6e7a7b819..e6272f179 100644 --- a/spec/unit/application/filebucket_spec.rb +++ b/spec/unit/application/filebucket_spec.rb @@ -3,6 +3,7 @@ require File.dirname(__FILE__) + '/../../spec_helper' require 'puppet/application/filebucket' +require 'puppet/file_bucket/dipper' describe Puppet::Application::Filebucket do before :each do diff --git a/spec/unit/application/queue_spec.rb b/spec/unit/application/queue_spec.rb index 87c96dfff..bd0d53ab1 100755 --- a/spec/unit/application/queue_spec.rb +++ b/spec/unit/application/queue_spec.rb @@ -3,6 +3,7 @@ require File.dirname(__FILE__) + '/../../spec_helper' require 'puppet/application/queue' +require 'puppet/indirector/catalog/queue' describe Puppet::Application::Queue do before :each do |
