From 7398fa171fdd6dcaeb2d8fd1c07a23bbd78891d0 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Thu, 16 Apr 2009 14:54:40 -0500 Subject: Partially fixing #2029 - failed caches doesn't throw an exception If the main terminus fails you get an exception, but not if a cache terminus fails. Signed-off-by: Luke Kanies --- spec/unit/indirector/indirection.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'spec') diff --git a/spec/unit/indirector/indirection.rb b/spec/unit/indirector/indirection.rb index dc4157fd2..a8bc8ba99 100755 --- a/spec/unit/indirector/indirection.rb +++ b/spec/unit/indirector/indirection.rb @@ -295,6 +295,21 @@ describe Puppet::Indirector::Indirection do @indirection.find("/my/key").should equal(@instance) end + it "should not fail if the cache fails" do + @terminus.stubs(:find).returns @instance + + @cache.expects(:find).raises ArgumentError + @cache.stubs(:save) + lambda { @indirection.find("/my/key") }.should_not raise_error + end + + it "should look in the main terminus if the cache fails" do + @terminus.expects(:find).returns @instance + @cache.expects(:find).raises ArgumentError + @cache.stubs(:save) + @indirection.find("/my/key").should equal(@instance) + end + it "should send a debug log if it is using the cached object" do Puppet.expects(:debug) @cache.stubs(:find).returns @instance -- cgit