diff options
author | Luke Kanies <luke@madstop.com> | 2008-03-24 16:37:56 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-03-24 16:37:56 -0500 |
commit | 528bbf1caefdd6963353df9242b81409f4dacbe5 (patch) | |
tree | 3791df515950127a0b0b92ba41434522fe351c8a /test | |
parent | 017f6730aa4b8afcc0f8da80c79eb6981a1ad6b9 (diff) | |
download | puppet-528bbf1caefdd6963353df9242b81409f4dacbe5.tar.gz puppet-528bbf1caefdd6963353df9242b81409f4dacbe5.tar.xz puppet-528bbf1caefdd6963353df9242b81409f4dacbe5.zip |
Fixing a couple of tests.
Diffstat (limited to 'test')
-rwxr-xr-x | test/network/client/client.rb | 29 | ||||
-rwxr-xr-x | test/network/client/master.rb | 29 | ||||
-rwxr-xr-x | test/ral/type/tidy.rb | 13 |
3 files changed, 35 insertions, 36 deletions
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/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 |