diff options
| author | Luke Kanies <luke@madstop.com> | 2008-03-25 18:18:34 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-03-25 18:18:34 -0500 |
| commit | a8592f1009040ebf30a98268610915cc33bb3f63 (patch) | |
| tree | 49f61323a8536d58ce332e97b882677f55727df7 /test | |
| parent | e1907798425a7b163ac1b831b0cf11e88985815e (diff) | |
| parent | 491a69682728818e04b8a20a5d8f4f783ad6ddaf (diff) | |
| download | puppet-a8592f1009040ebf30a98268610915cc33bb3f63.tar.gz puppet-a8592f1009040ebf30a98268610915cc33bb3f63.tar.xz puppet-a8592f1009040ebf30a98268610915cc33bb3f63.zip | |
Merge branch '0.24.x'
Conflicts:
install.rb
lib/puppet/defaults.rb
man/man8/puppet.8
Diffstat (limited to 'test')
| -rwxr-xr-x | test/language/parser.rb | 1 | ||||
| -rwxr-xr-x | test/network/client/client.rb | 29 | ||||
| -rwxr-xr-x | test/network/client/master.rb | 29 | ||||
| -rwxr-xr-x | test/network/handler/master.rb | 4 | ||||
| -rwxr-xr-x | test/ral/manager/provider.rb | 26 | ||||
| -rwxr-xr-x | test/ral/providers/mailalias/aliases.rb | 1 | ||||
| -rwxr-xr-x | test/ral/type/tidy.rb | 13 |
7 files changed, 61 insertions, 42 deletions
diff --git a/test/language/parser.rb b/test/language/parser.rb index 2a0e9c02d..2161a33f5 100755 --- a/test/language/parser.rb +++ b/test/language/parser.rb @@ -1141,6 +1141,7 @@ file { "/tmp/yayness": name = "sub" mk_module(modname, :init => %w{separate}, :sub => %w{separate::sub}) + Puppet.err :yay # First try it with a namespace klass = parser.findclass("separate", name) assert_instance_of(AST::HostClass, klass, "Did not autoload sub class from separate file with a namespace") diff --git a/test/network/client/client.rb b/test/network/client/client.rb index b6b915d31..5f96cac11 100755 --- a/test/network/client/client.rb +++ b/test/network/client/client.rb @@ -140,35 +140,6 @@ class TestClient < Test::Unit::TestCase } end - def test_classfile - Puppet[:code] = "class yaytest {}\n class bootest {}\n include yaytest, bootest" - - Puppet::Node::Facts.indirection.stubs(:save) - - master = client = nil - assert_nothing_raised() { - master = Puppet::Network::Handler.master.new( - :Local => false - ) - } - assert_nothing_raised() { - client = Puppet::Network::Client.master.new( - :Master => master - ) - } - - # Fake that it's local, so it creates the class file - client.local = false - - # We can't guarantee class ordering - client.expects(:setclasses).with do |array| - array.length == 2 and array.include?("yaytest") and array.include?("bootest") - end - assert_nothing_raised { - client.getconfig - } - end - def test_client_loading # Make sure we don't get a failure but that we also get nothing back assert_nothing_raised do diff --git a/test/network/client/master.rb b/test/network/client/master.rb index 28e7b8968..14c7dd852 100755 --- a/test/network/client/master.rb +++ b/test/network/client/master.rb @@ -576,4 +576,33 @@ end # Doesn't throw an exception, but definitely fails. client.run end + + def test_classfile + Puppet[:code] = "class yaytest {}\n class bootest {}\n include yaytest, bootest" + + Puppet::Node::Facts.indirection.stubs(:save) + + master = client = nil + assert_nothing_raised() { + master = Puppet::Network::Handler.master.new( + :Local => false + ) + } + assert_nothing_raised() { + client = Puppet::Network::Client.master.new( + :Master => master + ) + } + + # Fake that it's local, so it creates the class file + client.local = false + + # We can't guarantee class ordering + client.expects(:setclasses).with do |array| + array.length == 2 and array.include?("yaytest") and array.include?("bootest") + end + assert_nothing_raised { + client.getconfig + } + end end diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb index 88bfe6b7e..55522237b 100755 --- a/test/network/handler/master.rb +++ b/test/network/handler/master.rb @@ -90,11 +90,15 @@ class TestMaster < Test::Unit::TestCase resname, resip = master.send(:clientname, nil, nil, facts) assert_equal(facts["hostname"], resname, "Did not use fact hostname when no certname was present") assert_equal(facts["ipaddress"], resip, "Did not use fact ip when no certname was present") + assert_equal(facts["domain"], "fact_domain", "Did not use fact domain when no certname was present") + assert_equal(facts["fqdn"], "fact_hostname.fact_domain", "Did not use fact fqdn when no certname was present") # Now try it with the cert stuff present resname, resip = master.send(:clientname, certname, certip, facts) assert_equal(certname, resname, "Did not use cert hostname when certname was present") assert_equal(certip, resip, "Did not use cert ip when certname was present") + assert_equal(facts["domain"], certdomain, "Did not use cert domain when certname was present") + assert_equal(facts["fqdn"], certname, "Did not use cert fqdn when certname was present") # And reset the node_name stuff and make sure we use it. Puppet[:node_name] = :facter diff --git a/test/ral/manager/provider.rb b/test/ral/manager/provider.rb index bb7a21485..89aa49b9e 100755 --- a/test/ral/manager/provider.rb +++ b/test/ral/manager/provider.rb @@ -73,11 +73,6 @@ class TestTypeProviders < Test::Unit::TestCase confine :exists => "/no/such/file" end - inst = provider.new(:name => "bar") - assert_raise(Puppet::Error, "Did not fail on unsuitable provider instance") do - resource = @type.create :name => "bar", :provider => inst - end - # And make sure the provider must be a valid provider type for this resource pkgprov = Puppet::Type.type(:package).create(:name => "yayness").provider assert(provider, "did not get package provider") @@ -87,5 +82,26 @@ class TestTypeProviders < Test::Unit::TestCase end end + + # #571 -- so we can cause a provider to become suitable within + # a run. + def test_unsuitable_providers_should_not_fail_at_initialization + Puppet::Type.type(:user).provider(:useradd).stubs(:suitable?).returns false + + assert_nothing_raised("Unsuitable providers failed at initialization") do + Puppet::Type.type(:user).create :name => "luke", :ensure => :present, :provider => :useradd + end + end + + # #571 -- so we can cause a provider to become suitable within + # a run. + def test_unsuitable_providers_should_fail_at_evaluation + Puppet::Type.type(:user).provider(:useradd).stubs(:suitable?).returns false + + user = Puppet::Type.type(:user).create :name => "luke", :ensure => :present, :provider => :useradd + assert_raise(Puppet::Error, "Unsuitable provider did not fail at evaluation") do + user.evaluate + end + end end diff --git a/test/ral/providers/mailalias/aliases.rb b/test/ral/providers/mailalias/aliases.rb index 663d4359c..ec8b84684 100755 --- a/test/ral/providers/mailalias/aliases.rb +++ b/test/ral/providers/mailalias/aliases.rb @@ -4,7 +4,6 @@ require File.dirname(__FILE__) + '/../../../lib/puppettest' require 'puppettest' require 'puppettest/fileparsing' -require 'puppet/type/mailalias' class TestMailaliasAliasesProvider < Test::Unit::TestCase include PuppetTest diff --git a/test/ral/type/tidy.rb b/test/ral/type/tidy.rb index 17f98df22..657ca6e93 100755 --- a/test/ral/type/tidy.rb +++ b/test/ral/type/tidy.rb @@ -4,7 +4,6 @@ require File.dirname(__FILE__) + '/../../lib/puppettest' require 'puppettest' require 'puppettest/support/utils' -require 'puppet/type/tidy' class TestTidy < Test::Unit::TestCase include PuppetTest::Support::Utils @@ -76,7 +75,7 @@ class TestTidy < Test::Unit::TestCase # Test the different age iterations. def test_age_conversions - tidy = Puppet::Type.newtidy :path => tempfile(), :age => "1m" + tidy = Puppet::Type.type(:tidy).create :path => tempfile(), :age => "1m" convertors = { :second => 1, @@ -119,7 +118,7 @@ class TestTidy < Test::Unit::TestCase :gb => 3 } - tidy = Puppet::Type.newtidy :path => tempfile(), :age => "1m" + tidy = Puppet::Type.type(:tidy).create :path => tempfile(), :age => "1m" # First make sure we default to kb assert_nothing_raised do @@ -149,7 +148,7 @@ class TestTidy < Test::Unit::TestCase end def test_agetest - tidy = Puppet::Type.newtidy :path => tempfile(), :age => "1m" + tidy = Puppet::Type.type(:tidy).create :path => tempfile(), :age => "1m" age = tidy.property(:age) @@ -161,7 +160,7 @@ class TestTidy < Test::Unit::TestCase end def test_sizetest - tidy = Puppet::Type.newtidy :path => tempfile(), :size => "1k" + tidy = Puppet::Type.type(:tidy).create :path => tempfile(), :size => "1k" size = tidy.property(:size) @@ -175,7 +174,7 @@ class TestTidy < Test::Unit::TestCase # Make sure we can remove different types of files def test_tidytypes path = tempfile() - tidy = Puppet::Type.newtidy :path => path, :size => "1b", :age => "1s" + tidy = Puppet::Type.type(:tidy).create :path => path, :size => "1b", :age => "1s" # Start with a file File.open(path, "w") { |f| f.puts "this is a test" } @@ -232,7 +231,7 @@ class TestTidy < Test::Unit::TestCase Dir.mkdir(dir) File.symlink(target, link) - tidy = Puppet::Type.newtidy :path => dir, :size => "1b", :recurse => true + tidy = Puppet::Type.type(:tidy).create :path => dir, :size => "1b", :recurse => true assert_apply(tidy) assert(! FileTest.symlink?(link), "link was not tidied") end |
