diff options
Diffstat (limited to 'spec/unit/resource')
-rwxr-xr-x | spec/unit/resource/catalog_spec.rb | 37 | ||||
-rwxr-xr-x | spec/unit/resource/status_spec.rb | 6 |
2 files changed, 11 insertions, 32 deletions
diff --git a/spec/unit/resource/catalog_spec.rb b/spec/unit/resource/catalog_spec.rb index 896167a2b..6a9b1196f 100755 --- a/spec/unit/resource/catalog_spec.rb +++ b/spec/unit/resource/catalog_spec.rb @@ -2,30 +2,14 @@ require 'spec_helper' describe Puppet::Resource::Catalog, "when compiling" do + include PuppetSpec::Files before do - @basepath = Puppet.features.posix? ? "/somepath" : "C:/somepath" + @basepath = make_absolute("/somepath") # stub this to not try to create state.yaml 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") @@ -508,7 +492,7 @@ describe Puppet::Resource::Catalog, "when compiling" do @catalog.resource(:file, @basepath+"/something").should equal(resource) end - it "should not create aliases for non-isomorphic resources whose names do not match their titles" do + it "should not create aliases for non-isomorphic resources whose names do not match their titles", :fails_on_windows => true do resource = Puppet::Type.type(:exec).new(:title => "testing", :command => "echo", :path => %w{/bin /usr/bin /usr/local/bin}) @catalog.add_resource(resource) @@ -614,11 +598,12 @@ describe Puppet::Resource::Catalog, "when compiling" do end it "should conflict when its uniqueness key matches another resource's title" do - @resource = Puppet::Type.type(:file).new(:title => "/tmp/foo") - @other = Puppet::Type.type(:file).new(:title => "another file", :path => "/tmp/foo") + path = make_absolute("/tmp/foo") + @resource = Puppet::Type.type(:file).new(:title => path) + @other = Puppet::Type.type(:file).new(:title => "another file", :path => path) @catalog.add_resource(@resource) - expect { @catalog.add_resource(@other) }.to raise_error(ArgumentError, /Cannot alias File\[another file\] to \["\/tmp\/foo"\].*resource \["File", "\/tmp\/foo"\] already defined/) + expect { @catalog.add_resource(@other) }.to raise_error(ArgumentError, /Cannot alias File\[another file\] to \["#{Regexp.escape(path)}"\].*resource \["File", "#{Regexp.escape(path)}"\] already defined/) end it "should conflict when its uniqueness key matches the uniqueness key derived from another resource's title" do @@ -690,11 +675,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 @@ -855,8 +835,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 @@ -875,7 +853,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/resource/status_spec.rb b/spec/unit/resource/status_spec.rb index e5a9291db..18e3359df 100755 --- a/spec/unit/resource/status_spec.rb +++ b/spec/unit/resource/status_spec.rb @@ -4,14 +4,16 @@ require 'spec_helper' require 'puppet/resource/status' describe Puppet::Resource::Status do + include PuppetSpec::Files + before do - @resource = Puppet::Type.type(:file).new :path => "/my/file" + @resource = Puppet::Type.type(:file).new :path => make_absolute("/my/file") @status = Puppet::Resource::Status.new(@resource) end it "should compute type and title correctly" do @status.resource_type.should == "File" - @status.title.should == "/my/file" + @status.title.should == make_absolute("/my/file") end [:node, :file, :line, :current_values, :status, :evaluation_time].each do |attr| |