diff options
author | Luke Kanies <luke@madstop.com> | 2009-02-28 06:40:46 +0000 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2009-02-28 06:40:46 +0000 |
commit | 23066c1b117af4d531efad79ee11ed683ac92e5e (patch) | |
tree | 63f4963134fdeeb84a9d9b2a23537725cad675a6 /spec | |
parent | ec56ddf8f5b58f16d0067055346889be79b29186 (diff) | |
download | puppet-23066c1b117af4d531efad79ee11ed683ac92e5e.tar.gz puppet-23066c1b117af4d531efad79ee11ed683ac92e5e.tar.xz puppet-23066c1b117af4d531efad79ee11ed683ac92e5e.zip |
Fixing every failing test I can find on the build server.
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 <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/integration/checksum.rb | 1 | ||||
-rwxr-xr-x | spec/integration/reports.rb | 4 | ||||
-rwxr-xr-x | spec/integration/transaction/report.rb | 8 | ||||
-rwxr-xr-x | spec/integration/type/package.rb | 7 | ||||
-rwxr-xr-x | spec/unit/indirector/ssl_rsa/file.rb | 5 | ||||
-rwxr-xr-x | spec/unit/node/catalog.rb | 1 | ||||
-rwxr-xr-x | spec/unit/other/transbucket.rb | 8 | ||||
-rwxr-xr-x | spec/unit/provider/mount/parsed.rb | 1 | ||||
-rwxr-xr-x | spec/unit/rails.rb | 1 | ||||
-rwxr-xr-x | spec/unit/type/file.rb | 2 | ||||
-rwxr-xr-x | spec/unit/type/group.rb | 3 | ||||
-rwxr-xr-x | spec/unit/type/noop_metaparam.rb | 1 | ||||
-rwxr-xr-x | spec/unit/type/tidy.rb | 4 | ||||
-rwxr-xr-x | 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 c94f3e47e..49ae8d2b7 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 7351c3da1..cc4ae8f4c 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 48e59f203..333deac0e 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 def44ad97..a3d8eb278 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 76e5e3a94..4800f4a71 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 be198b88e..f6ef291a5 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 4494f2abb..0240a4473 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 df0e992f8..66891e6bf 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 382f7c0f4..694bb55c7 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 0b7bfa8fb..da03dd349 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 d7e06dcd8..66a7daf06 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 8510a1b6b..73fed53c1 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 9bcae86d7..3d0ff172b 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 dadcc65ef..4f4f2c0eb 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 |