diff options
Diffstat (limited to 'test/ral')
-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 |
3 files changed, 27 insertions, 13 deletions
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 |