diff options
author | Nick Lewis <nick@puppetlabs.com> | 2011-07-21 11:47:07 -0700 |
---|---|---|
committer | Jacob Helwig <jacob@puppetlabs.com> | 2011-08-19 13:52:56 -0700 |
commit | d6e0b71f141300da5241b6a0daf6afbc3eaa29e0 (patch) | |
tree | 04bcdafa892a2ad8c6aca457af27cb9d0c1c69d8 /spec | |
parent | d49dd9ec3ab26d122c5c2a78482136f2a5f3efda (diff) | |
download | puppet-d6e0b71f141300da5241b6a0daf6afbc3eaa29e0.tar.gz puppet-d6e0b71f141300da5241b6a0daf6afbc3eaa29e0.tar.xz puppet-d6e0b71f141300da5241b6a0daf6afbc3eaa29e0.zip |
Remove caching from the catalog, types, and parameters
Types and parameters were registering their catalog as their expirer, so that
the catalog could expire them between uses. However, because catalogs are never
reused (and neither are types or parameters), there is no need to expire
anything. Thus, we remove the entire cleanup/expire logic from catalog, type,
and parameter.
Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
(cherry picked from commit e2ea023f809c2bdc53b5259047c28f8061f57e54)
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/parameter_spec.rb | 10 | ||||
-rwxr-xr-x | spec/unit/resource/catalog_spec.rb | 25 | ||||
-rwxr-xr-x | spec/unit/type_spec.rb | 16 |
3 files changed, 0 insertions, 51 deletions
diff --git a/spec/unit/parameter_spec.rb b/spec/unit/parameter_spec.rb index 04556c013..1ed211957 100755 --- a/spec/unit/parameter_spec.rb +++ b/spec/unit/parameter_spec.rb @@ -25,16 +25,6 @@ describe Puppet::Parameter do @parameter.to_s.should == @parameter.name.to_s end - it "should be able to use cached attributes" do - Puppet::Parameter.ancestors.should be_include(Puppet::Util::Cacher) - end - - it "should use the resource catalog for expiration" do - catalog = mock 'catalog' - @resource.stubs(:catalog).returns catalog - @parameter.expirer.should equal(catalog) - end - [:line, :file, :version].each do |data| it "should return its resource's #{data} as its #{data}" do @resource.expects(data).returns "foo" diff --git a/spec/unit/resource/catalog_spec.rb b/spec/unit/resource/catalog_spec.rb index 7d513fdc6..a5743afa3 100755 --- a/spec/unit/resource/catalog_spec.rb +++ b/spec/unit/resource/catalog_spec.rb @@ -10,23 +10,6 @@ describe Puppet::Resource::Catalog, "when compiling" do Puppet::Util::Storage.stubs(:store) end - it "should be an Expirer" do - Puppet::Resource::Catalog.ancestors.should be_include(Puppet::Util::Cacher::Expirer) - end - - it "should always be expired if it's not applying" do - @catalog = Puppet::Resource::Catalog.new("host") - @catalog.expects(:applying?).returns false - @catalog.should be_dependent_data_expired(Time.now) - end - - it "should not be expired if it's applying and the timestamp is late enough" do - @catalog = Puppet::Resource::Catalog.new("host") - @catalog.expire - @catalog.expects(:applying?).returns true - @catalog.should_not be_dependent_data_expired(Time.now) - end - it "should be able to write its list of classes to the class file" do @catalog = Puppet::Resource::Catalog.new("host") @@ -691,11 +674,6 @@ describe Puppet::Resource::Catalog, "when compiling" do @catalog.apply(:ignoreschedules => true) end - it "should expire cached data in the resources both before and after the transaction" do - @catalog.expects(:expire).times(2) - @catalog.apply - end - describe "host catalogs" do # super() doesn't work in the setup method for some reason @@ -856,8 +834,6 @@ describe Puppet::Resource::Catalog, "when compiling" do @real_indirection = Puppet::Resource::Catalog.indirection @indirection = stub 'indirection', :name => :catalog - - Puppet::Util::Cacher.expire end it "should use the value of the 'catalog_terminus' setting to determine its terminus class" do @@ -876,7 +852,6 @@ describe Puppet::Resource::Catalog, "when compiling" do end after do - Puppet::Util::Cacher.expire @real_indirection.reset_terminus_class end end diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb index 73150af48..218c626d2 100755 --- a/spec/unit/type_spec.rb +++ b/spec/unit/type_spec.rb @@ -4,10 +4,6 @@ require 'spec_helper' describe Puppet::Type, :'fails_on_windows' => true do include PuppetSpec::Files - it "should include the Cacher module" do - Puppet::Type.ancestors.should be_include(Puppet::Util::Cacher) - end - it "should consider a parameter to be valid if it is a valid parameter" do Puppet::Type.type(:mount).should be_valid_parameter(:path) end @@ -20,18 +16,6 @@ describe Puppet::Type, :'fails_on_windows' => true do Puppet::Type.type(:mount).should be_valid_parameter(:noop) end - it "should use its catalog as its expirer" do - catalog = Puppet::Resource::Catalog.new - resource = Puppet::Type.type(:mount).new(:name => "foo", :fstype => "bar", :pass => 1, :ensure => :present) - resource.catalog = catalog - resource.expirer.should equal(catalog) - end - - it "should do nothing when asked to expire when it has no catalog" do - resource = Puppet::Type.type(:mount).new(:name => "foo", :fstype => "bar", :pass => 1, :ensure => :present) - lambda { resource.expire }.should_not raise_error - end - it "should be able to retrieve a property by name" do resource = Puppet::Type.type(:mount).new(:name => "foo", :fstype => "bar", :pass => 1, :ensure => :present) resource.property(:fstype).must be_instance_of(Puppet::Type.type(:mount).attrclass(:fstype)) |