All but one of these tests is fixed by: * Stubbing Puppet.settings.use * Adding /usr/sbin to PATH
The only other one was the package integration test, which stupidly assumed a default was specified in the test. The fix here is twofold: Remove that assumption (the test is now 'pending' if no default is available), and add a default for Ubuntu. (The default is in the test, not the default package provider - that is, it's testing the default package provider, thus it can't rely on that information.) Signed-off-by: Luke Kanies <[email protected]> --- spec/integration/checksum.rb | 1 + spec/integration/reports.rb | 4 ++++ spec/integration/transaction/report.rb | 8 +++++++- spec/integration/type/package.rb | 7 +++++-- spec/unit/indirector/ssl_rsa/file.rb | 5 +++++ spec/unit/node/catalog.rb | 1 + spec/unit/other/transbucket.rb | 8 ++++---- spec/unit/provider/mount/parsed.rb | 1 + spec/unit/rails.rb | 1 + spec/unit/type/file.rb | 2 ++ spec/unit/type/group.rb | 3 +++ spec/unit/type/noop_metaparam.rb | 1 + spec/unit/type/tidy.rb | 4 ++++ spec/unit/type/user.rb | 3 +++ 14 files changed, 42 insertions(+), 7 deletions(-) diff --git a/spec/integration/checksum.rb b/spec/integration/checksum.rb index c94f3e4..49ae8d2 100755 --- a/spec/integration/checksum.rb +++ b/spec/integration/checksum.rb @@ -9,6 +9,7 @@ require 'puppet/checksum' describe Puppet::Checksum, " when using the file terminus" do before do + Puppet.settings.stubs(:use) Puppet::Checksum.terminus_class = :file @content = "this is some content" @sum = Puppet::Checksum.new(@content) diff --git a/spec/integration/reports.rb b/spec/integration/reports.rb index 7351c3d..cc4ae8f 100755 --- a/spec/integration/reports.rb +++ b/spec/integration/reports.rb @@ -8,6 +8,10 @@ require File.dirname(__FILE__) + '/../spec_helper' require 'puppet/reports' describe Puppet::Reports, " when using report types" do + before do + Puppet.settings.stubs(:use) + end + it "should load report types as modules" do Puppet::Reports.report(:store).should be_instance_of(Module) end diff --git a/spec/integration/transaction/report.rb b/spec/integration/transaction/report.rb index 48e59f2..333deac 100755 --- a/spec/integration/transaction/report.rb +++ b/spec/integration/transaction/report.rb @@ -7,7 +7,13 @@ require File.dirname(__FILE__) + '/../../spec_helper' describe Puppet::Transaction::Report do describe "when using the indirector" do - after { Puppet::Transaction::Report.indirection.clear_cache } + before do + Puppet.settings.stubs(:use) + end + + after do + Puppet::Transaction::Report.indirection.clear_cache + end it "should be able to delegate to the :processor terminus" do Puppet::Transaction::Report.indirection.stubs(:terminus_class).returns :processor diff --git a/spec/integration/type/package.rb b/spec/integration/type/package.rb index def44ad..a3d8eb2 100755 --- a/spec/integration/type/package.rb +++ b/spec/integration/type/package.rb @@ -9,7 +9,7 @@ describe Puppet::Type.type(:package), "when choosing a default package provider" end def provider_name(os) - {"Debian" => :apt, "Darwin" => :apple, "RedHat" => :up2date, "Fedora" => :yum, "FreeBSD" => :ports, "OpenBSD" => :openbsd, "Solaris" => :sun}[os] + {"Ubuntu" => :apt, "Debian" => :apt, "Darwin" => :apple, "RedHat" => :up2date, "Fedora" => :yum, "FreeBSD" => :ports, "OpenBSD" => :openbsd, "Solaris" => :sun}[os] end it "should have a default provider" do @@ -17,6 +17,9 @@ describe Puppet::Type.type(:package), "when choosing a default package provider" end it "should choose the correct provider each platform" do - Puppet::Type.type(:package).defaultprovider.name.should == provider_name(Facter.value(:operatingsystem)) + unless default_provider = provider_name(Facter.value(:operatingsystem)) + pending("No default provider specified in this test for %s" % Facter.value(:operatingsystem)) + end + Puppet::Type.type(:package).defaultprovider.name.should == default_provider end end diff --git a/spec/unit/indirector/ssl_rsa/file.rb b/spec/unit/indirector/ssl_rsa/file.rb index 76e5e3a..4800f4a 100755 --- a/spec/unit/indirector/ssl_rsa/file.rb +++ b/spec/unit/indirector/ssl_rsa/file.rb @@ -22,6 +22,7 @@ end describe Puppet::Indirector::SslRsa::File, " when choosing a path for a ca key" do before do + Puppet.settings.stubs(:use) @file = Puppet::Indirector::SslRsa::File.new @name = :ca end @@ -38,6 +39,7 @@ end describe Puppet::Indirector::SslRsa::File, " when choosing a path for a non-ca key" do before do + Puppet.settings.stubs(:use) @file = Puppet::Indirector::SslRsa::File.new @name = :publickey end @@ -54,6 +56,7 @@ end describe Puppet::Indirector::SslRsa::File, " when saving" do before do + Puppet.settings.stubs(:use) @file = Puppet::Indirector::SslRsa::File.new Puppet.settings.stubs(:value).with(:publickeydir).returns("/dir") @@ -72,6 +75,7 @@ end describe Puppet::Indirector::SslRsa::File, " when finding a key by name" do before do + Puppet.settings.stubs(:use) @file = Puppet::Indirector::SslRsa::File.new Puppet.settings.stubs(:value).with(:publickeydir).returns("/dir") @@ -95,6 +99,7 @@ end describe Puppet::Indirector::SslRsa::File, " when removing a key" do before do + Puppet.settings.stubs(:use) @file = Puppet::Indirector::SslRsa::File.new Puppet.settings.stubs(:value).with(:publickeydir).returns("/dir") diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb index be198b8..f6ef291 100755 --- a/spec/unit/node/catalog.rb +++ b/spec/unit/node/catalog.rb @@ -794,6 +794,7 @@ describe Puppet::Node::Catalog, " when writing dot files" do end it "should write a dot file based on the passed name" do + Puppet.settings.stubs(:use) File.expects(:open).with(@file, "w").yields(stub("file", :puts => nil)) @catalog.expects(:to_dot).with("name" => @name.to_s.capitalize) @catalog.host_config = true diff --git a/spec/unit/other/transbucket.rb b/spec/unit/other/transbucket.rb index 4494f2a..0240a44 100755 --- a/spec/unit/other/transbucket.rb +++ b/spec/unit/other/transbucket.rb @@ -70,20 +70,20 @@ describe Puppet::TransBucket, " when generating a catalog" do @bottom = Puppet::TransBucket.new @bottom.type = "fake" @bottom.name = "bottom" - @bottomobj = Puppet::TransObject.new("bottom", "user") + @bottomobj = Puppet::TransObject.new("bottom", "notify") @bottom.push @bottomobj @middle = Puppet::TransBucket.new @middle.type = "fake" @middle.name = "middle" - @middleobj = Puppet::TransObject.new("middle", "user") + @middleobj = Puppet::TransObject.new("middle", "notify") @middle.push(@middleobj) @middle.push(@bottom) @top = Puppet::TransBucket.new @top.type = "fake" @top.name = "top" - @topobj = Puppet::TransObject.new("top", "user") + @topobj = Puppet::TransObject.new("top", "notify") @top.push(@topobj) @top.push(@middle) @@ -98,7 +98,7 @@ describe Puppet::TransBucket, " when generating a catalog" do it "should convert all transportable objects to RAL resources" do @catalog = @top.to_catalog @users.each do |name| - @catalog.vertices.find { |r| r.class.name == :user and r.title == name }.should be_instance_of(Puppet::Type.type(:user)) + @catalog.vertices.find { |r| r.class.name == :notify and r.title == name }.should be_instance_of(Puppet::Type.type(:notify)) end end diff --git a/spec/unit/provider/mount/parsed.rb b/spec/unit/provider/mount/parsed.rb index df0e992..66891e6 100755 --- a/spec/unit/provider/mount/parsed.rb +++ b/spec/unit/provider/mount/parsed.rb @@ -130,6 +130,7 @@ describe provider_class do describe provider_class, " when modifying the filesystem tab" do include ParsedMountTesting before do + Puppet.settings.stubs(:use) # Never write to disk, only to RAM. @provider_class.stubs(:filetype).returns(Puppet::Util::FileType.filetype(:ram)) diff --git a/spec/unit/rails.rb b/spec/unit/rails.rb index 382f7c0..694bb55 100755 --- a/spec/unit/rails.rb +++ b/spec/unit/rails.rb @@ -7,6 +7,7 @@ describe Puppet::Rails, "when initializing any connection" do confine "Cannot test without ActiveRecord" => Puppet.features.rails? before do + Puppet.settings.stubs(:use) @logger = mock 'logger' @logger.stub_everything Logger.stubs(:new).returns(@logger) diff --git a/spec/unit/type/file.rb b/spec/unit/type/file.rb index 0b7bfa8..da03dd3 100755 --- a/spec/unit/type/file.rb +++ b/spec/unit/type/file.rb @@ -4,6 +4,8 @@ require File.dirname(__FILE__) + '/../../spec_helper' describe Puppet::Type.type(:file) do before do + Puppet.settings.stubs(:use) + @path = Tempfile.new("puppetspec") @path.close!() @path = @path.path diff --git a/spec/unit/type/group.rb b/spec/unit/type/group.rb index d7e06dc..66a7daf 100755 --- a/spec/unit/type/group.rb +++ b/spec/unit/type/group.rb @@ -4,6 +4,9 @@ require File.dirname(__FILE__) + '/../../spec_helper' describe Puppet::Type.type(:group) do before do + unless ENV["PATH"].split(File::PATH_SEPARATOR).include?("/usr/sbin") + ENV["PATH"] += File::PATH_SEPARATOR + "/usr/sbin" + end @class = Puppet::Type.type(:group) end diff --git a/spec/unit/type/noop_metaparam.rb b/spec/unit/type/noop_metaparam.rb index 8510a1b..73fed53 100755 --- a/spec/unit/type/noop_metaparam.rb +++ b/spec/unit/type/noop_metaparam.rb @@ -6,6 +6,7 @@ require 'puppet/type' describe Puppet::Type.type(:file).attrclass(:noop) do before do + Puppet.settings.stubs(:use) @file = Puppet::Type.newfile :path => "/what/ever" end diff --git a/spec/unit/type/tidy.rb b/spec/unit/type/tidy.rb index 9bcae86..3d0ff17 100755 --- a/spec/unit/type/tidy.rb +++ b/spec/unit/type/tidy.rb @@ -5,6 +5,10 @@ require File.dirname(__FILE__) + '/../../spec_helper' tidy = Puppet::Type.type(:tidy) describe tidy do + before do + Puppet.settings.stubs(:use) + end + after { tidy.clear } it "should be in sync if the targeted file does not exist" do diff --git a/spec/unit/type/user.rb b/spec/unit/type/user.rb index dadcc65..4f4f2c0 100755 --- a/spec/unit/type/user.rb +++ b/spec/unit/type/user.rb @@ -6,6 +6,9 @@ user = Puppet::Type.type(:user) describe user do before do + unless ENV["PATH"].split(File::PATH_SEPARATOR).include?("/usr/sbin") + ENV["PATH"] += File::PATH_SEPARATOR + "/usr/sbin" + end @provider = stub 'provider' @resource = stub 'resource', :resource => nil, :provider => @provider, :line => nil, :file => nil end -- 1.6.1 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---
