diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2011-07-21 11:53:06 -0700 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2011-07-21 20:10:28 -0700 |
| commit | d198fedf65e472b384666fc9ae3bef487852068a (patch) | |
| tree | 30b0b4175bb52d8442c6899f7463c6fe7aba8199 /spec/integration | |
| parent | 7048b4c4d8c4a8ad45caf6a02b263ac0a9fa333e (diff) | |
Rework Puppet::Util::Cacher to only expire using TTLs
We have removed every usage of cached_attr in which the attribute needs to be
manually expired. Thus, the only meaningful behavior provided by
Puppet::Util::Cacher is expiration based on TTLs. This commit reworks the
cacher to only support that behavior.
Rather than accepting an options hash, of which :ttl is the only available
option, cached_attr now requires a second argument, which is the TTL.
TTLs are now used to compute expirations, which are stored and used for
expiring values. Previously, we stored a timestamp and used it and the TTL to
determine whether the attribute was expired. This had the potentially
undesirable side effect that the lifetime of a cached attribute could be
extended after its insertion by modifying the TTL setting for the cache. Now,
the lifetime of an attribute is determined when it is set, and is thereafter
immutable, aside from deliberately re-setting the expiration for that
particular attribute.
Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'spec/integration')
| -rwxr-xr-x | spec/integration/file_serving/content_spec.rb | 2 | ||||
| -rwxr-xr-x | spec/integration/file_serving/metadata_spec.rb | 2 | ||||
| -rwxr-xr-x | spec/integration/network/server/webrick_spec.rb | 1 | ||||
| -rwxr-xr-x | spec/integration/node/facts_spec.rb | 2 | ||||
| -rwxr-xr-x | spec/integration/resource/catalog_spec.rb | 1 | ||||
| -rwxr-xr-x | spec/integration/ssl/host_spec.rb | 1 | ||||
| -rwxr-xr-x | spec/integration/transaction/report_spec.rb | 1 |
7 files changed, 0 insertions, 10 deletions
diff --git a/spec/integration/file_serving/content_spec.rb b/spec/integration/file_serving/content_spec.rb index a95ddc520..e82b726fe 100755 --- a/spec/integration/file_serving/content_spec.rb +++ b/spec/integration/file_serving/content_spec.rb @@ -15,6 +15,4 @@ describe Puppet::FileServing::Content, " when finding files" do @test_class = Puppet::FileServing::Content @indirection = Puppet::FileServing::Content.indirection end - - after { Puppet::Util::Cacher.expire } end diff --git a/spec/integration/file_serving/metadata_spec.rb b/spec/integration/file_serving/metadata_spec.rb index ba7d3311f..8b4d53d6b 100755 --- a/spec/integration/file_serving/metadata_spec.rb +++ b/spec/integration/file_serving/metadata_spec.rb @@ -16,6 +16,4 @@ describe Puppet::FileServing::Metadata, " when finding files" do @test_class = Puppet::FileServing::Metadata @indirection = Puppet::FileServing::Metadata.indirection end - - after { Puppet::Util::Cacher.expire } end diff --git a/spec/integration/network/server/webrick_spec.rb b/spec/integration/network/server/webrick_spec.rb index 81c35af4f..2390fcab1 100755 --- a/spec/integration/network/server/webrick_spec.rb +++ b/spec/integration/network/server/webrick_spec.rb @@ -32,7 +32,6 @@ describe Puppet::Network::Server do system("rm -rf #{@dir}") Puppet::SSL::Host.ca_location = :none - Puppet::Util::Cacher.expire end describe "before listening" do diff --git a/spec/integration/node/facts_spec.rb b/spec/integration/node/facts_spec.rb index f54d7f9aa..4ec4bc821 100755 --- a/spec/integration/node/facts_spec.rb +++ b/spec/integration/node/facts_spec.rb @@ -7,8 +7,6 @@ require 'spec_helper' describe Puppet::Node::Facts do describe "when using the indirector" do - after { Puppet::Util::Cacher.expire } - it "should expire any cached node instances when it is saved" do Puppet::Node::Facts.indirection.stubs(:terminus_class).returns :yaml diff --git a/spec/integration/resource/catalog_spec.rb b/spec/integration/resource/catalog_spec.rb index 41a475d98..ae15ee453 100755 --- a/spec/integration/resource/catalog_spec.rb +++ b/spec/integration/resource/catalog_spec.rb @@ -13,7 +13,6 @@ describe Puppet::Resource::Catalog do end describe "when using the indirector" do - after { Puppet::Util::Cacher.expire } before do # This is so the tests work w/out networking. Facter.stubs(:to_hash).returns({"hostname" => "foo.domain.com"}) diff --git a/spec/integration/ssl/host_spec.rb b/spec/integration/ssl/host_spec.rb index 2da5bcfe3..53ff88ea4 100755 --- a/spec/integration/ssl/host_spec.rb +++ b/spec/integration/ssl/host_spec.rb @@ -30,7 +30,6 @@ describe Puppet::SSL::Host, :fails_on_windows => true do system("rm -rf #{@dir}") Puppet.settings.clear - Puppet::Util::Cacher.expire } it "should be considered a CA host if its name is equal to 'ca'" do diff --git a/spec/integration/transaction/report_spec.rb b/spec/integration/transaction/report_spec.rb index 183d93f76..315c0c099 100755 --- a/spec/integration/transaction/report_spec.rb +++ b/spec/integration/transaction/report_spec.rb @@ -8,7 +8,6 @@ require 'spec_helper' describe Puppet::Transaction::Report do describe "when using the indirector" do after do - Puppet::Util::Cacher.expire Puppet.settings.stubs(:use) end |
