diff options
| author | Luke Kanies <luke@madstop.com> | 2008-07-15 19:01:12 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2009-02-06 18:08:39 -0600 |
| commit | 2afff60abe430dc1e2660fa82807e131e1dc71aa (patch) | |
| tree | c9f65993e46214e9123ae6f79da368d185ba612d /spec | |
| parent | 361db45875768727d3c5f310c76850f350e6441f (diff) | |
| download | puppet-2afff60abe430dc1e2660fa82807e131e1dc71aa.tar.gz puppet-2afff60abe430dc1e2660fa82807e131e1dc71aa.tar.xz puppet-2afff60abe430dc1e2660fa82807e131e1dc71aa.zip | |
Adding support for skipping cached indirection instances.
This will allow the soon-to-be-created Agent class to
skip cached catalogs when desired.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/indirector/indirection.rb | 9 | ||||
| -rwxr-xr-x | spec/unit/indirector/request.rb | 8 |
2 files changed, 16 insertions, 1 deletions
diff --git a/spec/unit/indirector/indirection.rb b/spec/unit/indirector/indirection.rb index 564b2d871..6fdb2ba57 100755 --- a/spec/unit/indirector/indirection.rb +++ b/spec/unit/indirector/indirection.rb @@ -246,7 +246,7 @@ describe Puppet::Indirector::Indirection do describe "when caching is enabled" do before do @indirection.cache_class = :cache_terminus - @cache_class.expects(:new).returns(@cache) + @cache_class.stubs(:new).returns(@cache) @instance.stubs(:expired?).returns false end @@ -258,6 +258,13 @@ describe Puppet::Indirector::Indirection do @indirection.find("/my/key") end + it "should not look in the cache if the request specifies not to use the cache" do + @terminus.expects(:find).returns @instance + @cache.expects(:find).never + + @indirection.find("/my/key", :use_cache => false) + end + it "should use a request to look in the cache for cached objects" do @cache.expects(:find).with { |r| r.method == :find and r.key == "/my/key" }.returns @instance diff --git a/spec/unit/indirector/request.rb b/spec/unit/indirector/request.rb index 18f625946..5203280d8 100755 --- a/spec/unit/indirector/request.rb +++ b/spec/unit/indirector/request.rb @@ -126,6 +126,14 @@ describe Puppet::Indirector::Request do Puppet::Indirector::Request.new(:ind, :method, "http:///stuff").uri.should == "http:///stuff" end end + + it "should allow indication that it should not use a cached instance" do + Puppet::Indirector::Request.new(:ind, :method, :key, :use_cache => false).should_not be_use_cache + end + + it "should default to using cached instances" do + Puppet::Indirector::Request.new(:ind, :method, :key).should be_use_cache + end end it "should look use the Indirection class to return the appropriate indirection" do |
