diff options
| author | Luke Kanies <luke@madstop.com> | 2008-11-14 19:15:37 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-11-15 02:25:47 -0600 |
| commit | a8d9976d0a11c4dc50b2ef49c63f3f745cb4eccb (patch) | |
| tree | efcbed81569954f135dacc4df11f7988f383e621 /spec/unit/node | |
| parent | 8b0843913c4c4ef063c3f1fb1fec674406bc193d (diff) | |
| download | puppet-a8d9976d0a11c4dc50b2ef49c63f3f745cb4eccb.tar.gz puppet-a8d9976d0a11c4dc50b2ef49c63f3f745cb4eccb.tar.xz puppet-a8d9976d0a11c4dc50b2ef49c63f3f745cb4eccb.zip | |
Catalogs always consider resource data to be expired if not mid-transaction.
This way we'll cache when in a transaction, but otherwise always
hit the disk so the data is fresh. This works because we
really only use resources mid-transaction, but it behaves correctly
if we happen to use a resource outside of a transaction.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/node')
| -rwxr-xr-x | spec/unit/node/catalog.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb index 3c4da5908..e23c53d3a 100755 --- a/spec/unit/node/catalog.rb +++ b/spec/unit/node/catalog.rb @@ -615,6 +615,17 @@ describe Puppet::Node::Catalog do Puppet::Node::Catalog.ancestors.should be_include(Puppet::Util::Cacher::Expirer) end + it "should always be expired if it's not applying" do + @catalog.expects(:applying?).returns false + @catalog.should be_expired(Time.now) + end + + it "should not be expired if it's applying and the timestamp is late enough" do + @catalog.expire + @catalog.expects(:applying?).returns true + @catalog.should_not be_expired(Time.now) + end + describe "when applying" do it "should create and evaluate a transaction" do @transaction.expects(:evaluate) |
