summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@rimspace.net>2011-03-03 10:56:00 -0800
committerDaniel Pittman <daniel@rimspace.net>2011-03-03 16:30:18 -0800
commit93082e4a683d417603aeb3bffb73b45d007315a7 (patch)
tree516d29e09e423392757e1c72b53b115a22ed6898
parent92499c86bc7fcc4c7b7d5de838973868a5e0aba2 (diff)
(#6582) unstub Puppet settings to improve indirector queue tests.
This code was stubbing Puppet settings, which is no longer required now we reset them between tests. Using the real thing reduces points that the rest of the code can break, too. As a side effect this caused Puppet[:trace] to be "true", which meant that we emitted a huge, nasty backtrace during the testing of a specific internal failure handling case. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
-rwxr-xr-xspec/unit/indirector/queue_spec.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/spec/unit/indirector/queue_spec.rb b/spec/unit/indirector/queue_spec.rb
index 7732e411a..49e5e1015 100755
--- a/spec/unit/indirector/queue_spec.rb
+++ b/spec/unit/indirector/queue_spec.rb
@@ -42,8 +42,7 @@ describe Puppet::Indirector::Queue, :if => Puppet.features.pson? do
@subject = @subject_class.new
@subject.name = :me
- Puppet.settings.stubs(:value).returns("bogus setting data")
- Puppet.settings.stubs(:value).with(:queue_type).returns(:test_client)
+ Puppet[:queue_type] = :test_client
Puppet::Util::Queue.stubs(:queue_type_to_class).with(:test_client).returns(Puppet::Indirector::Queue::TestClient)
@request = stub 'request', :key => :me, :instance => @subject
@@ -112,9 +111,12 @@ describe Puppet::Indirector::Queue, :if => Puppet.features.pson? do
it "should log but not propagate errors" do
@store_class.client.expects(:subscribe).yields("foo")
- @store_class.expects(:intern).raises ArgumentError
- Puppet.expects(:err)
- @store_class.subscribe {|o| o }
+ @store_class.expects(:intern).raises(ArgumentError)
+ expect { @store_class.subscribe {|o| o } }.should_not raise_error
+
+ @logs.length.should == 1
+ @logs.first.message.should =~ /Error occured with subscription to queue my_queue for indirection my_queue: ArgumentError/
+ @logs.first.level.should == :err
end
end
end