diff options
author | Luke Kanies <luke@madstop.com> | 2009-04-16 14:54:40 -0500 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-04-17 16:15:47 +1000 |
commit | 7398fa171fdd6dcaeb2d8fd1c07a23bbd78891d0 (patch) | |
tree | de0aa525b85c15645119a355b9c21be30d3c2d55 /spec/unit | |
parent | 88ff9c6500e76fdda02e60262dd1571577c0b92b (diff) | |
download | puppet-7398fa171fdd6dcaeb2d8fd1c07a23bbd78891d0.tar.gz puppet-7398fa171fdd6dcaeb2d8fd1c07a23bbd78891d0.tar.xz puppet-7398fa171fdd6dcaeb2d8fd1c07a23bbd78891d0.zip |
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 <luke@madstop.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-x | spec/unit/indirector/indirection.rb | 15 |
1 files changed, 15 insertions, 0 deletions
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 |