diff options
Diffstat (limited to 'test')
| -rwxr-xr-x | test/other/events.rb | 4 | ||||
| -rwxr-xr-x | test/other/relationships.rb | 65 | ||||
| -rwxr-xr-x | test/other/report.rb | 3 | ||||
| -rwxr-xr-x | test/other/transactions.rb | 6 | ||||
| -rwxr-xr-x | test/types/file.rb | 7 | ||||
| -rwxr-xr-x | test/types/filesources.rb | 4 | ||||
| -rwxr-xr-x | test/types/host.rb | 20 | ||||
| -rwxr-xr-x | test/types/type.rb | 3 |
8 files changed, 34 insertions, 78 deletions
diff --git a/test/other/events.rb b/test/other/events.rb index 078e6351f..802a701a3 100755 --- a/test/other/events.rb +++ b/test/other/events.rb @@ -9,10 +9,6 @@ require 'puppettest' class TestEvents < Test::Unit::TestCase include PuppetTest - def teardown - super - Puppet::Event::Subscription.clear - end def test_simplesubscribe name = tempfile() diff --git a/test/other/relationships.rb b/test/other/relationships.rb index 164d52d2a..7b321d821 100755 --- a/test/other/relationships.rb +++ b/test/other/relationships.rb @@ -7,6 +7,11 @@ require 'puppettest' class TestRelationships < Test::Unit::TestCase include PuppetTest + def setup + super + Puppet::Type.type(:exec) + end + def newfile assert_nothing_raised() { return Puppet.type(:file).create( @@ -151,66 +156,6 @@ class TestRelationships < Test::Unit::TestCase assert_equal(symbols, result) end - - def test_newsub - file1 = newfile() - file2 = newfile() - - sub = nil - assert_nothing_raised("Could not create subscription") { - sub = Puppet::Event::Subscription.new( - :source => file1, - :target => file2, - :event => :ALL_EVENTS, - :callback => :refresh - ) - } - - subs = nil - - assert_nothing_raised { - subs = Puppet::Event::Subscription.subscribers(file1) - } - assert_equal(1, subs.length, "Got incorrect number of subs") - assert_equal(sub.target, subs[0], "Got incorrect sub") - - deps = nil - assert_nothing_raised { - deps = Puppet::Event::Subscription.dependencies(file2) - } - assert_equal(1, deps.length, "Got incorrect number of deps") - assert_equal(sub, deps[0], "Got incorrect dep") - end - - def test_eventmatch - file1 = newfile() - file2 = newfile() - - sub = nil - assert_nothing_raised("Could not create subscription") { - sub = Puppet::Event::Subscription.new( - :source => file1, - :target => file2, - :event => :ALL_EVENTS, - :callback => :refresh - ) - } - - assert(sub.match?(:anything), "ALL_EVENTS did not match") - assert(! sub.match?(:NONE), "ALL_EVENTS matched :NONE") - - sub.event = :file_created - - assert(sub.match?(:file_created), "event did not match") - assert(sub.match?(:ALL_EVENTS), "ALL_EVENTS did not match") - assert(! sub.match?(:NONE), "ALL_EVENTS matched :NONE") - - sub.event = :NONE - - assert(! sub.match?(:file_created), "Invalid match") - assert(! sub.match?(:ALL_EVENTS), "ALL_EVENTS matched") - assert(! sub.match?(:NONE), "matched :NONE") - end def test_autorequire # We know that execs autorequire their cwd, so we'll use that diff --git a/test/other/report.rb b/test/other/report.rb index 939d87aaf..551cf4b28 100755 --- a/test/other/report.rb +++ b/test/other/report.rb @@ -60,6 +60,9 @@ class TestReports < Test::Unit::TestCase def test_store_report # Create a bunch of log messages in an array. report = Puppet::Transaction::Report.new + + # We have to reuse reporting here because of something going on in the server/report.rb file + Puppet.config.use(:reporting) 3.times { |i| log = Puppet.warning("Report test message %s" % i) diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 256c815f7..d9a173986 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -527,14 +527,14 @@ class TestTransactions < Test::Unit::TestCase sorted = graph.topsort.reverse # Now make sure the appropriate edges are there and are in the right order - assert(graph.dependencies(f(:f)).include?(f(:c)), + assert(graph.dependents(f(:f)).include?(f(:c)), "c not marked a dep of f") assert(sorted.index(f(:c)) < sorted.index(f(:f)), "c is not before f") one.each do |o| two.each do |t| - assert(graph.dependencies(o).include?(t), + assert(graph.dependents(o).include?(t), "%s not marked a dep of %s" % [t.ref, o.ref]) assert(sorted.index(t) < sorted.index(o), "%s is not before %s" % [t.ref, o.ref]) @@ -542,7 +542,7 @@ class TestTransactions < Test::Unit::TestCase end trans.resources.leaves(middle).each do |child| - assert(graph.dependencies(f(:h)).include?(child), + assert(graph.dependents(f(:h)).include?(child), "%s not marked a dep of h" % [child.ref]) assert(sorted.index(child) < sorted.index(f(:h)), "%s is not before h" % child.ref) diff --git a/test/types/file.rb b/test/types/file.rb index 917b2e755..f93d3670b 100755 --- a/test/types/file.rb +++ b/test/types/file.rb @@ -1571,14 +1571,8 @@ class TestFile < Test::Unit::TestCase :source => sourcedir, :recurse => true) - puts "a" comp = newcomp(lfobj, destobj) - # trans = comp.evaluate assert_apply(comp) - # assert_nothing_raised { trans.evaluate } - puts "b" - # graph = trans.relgraph - # graph.to_jpg("/Users/luke/Desktop/pics", "purging") assert(FileTest.exists?(dsourcefile), "File did not get copied") assert(FileTest.exists?(localfile), "File did not get created") @@ -1586,7 +1580,6 @@ class TestFile < Test::Unit::TestCase assert_nothing_raised { destobj[:purge] = true } assert_apply(comp) - system("find %s" % destdir) assert(FileTest.exists?(dsourcefile), "File got purged") assert(FileTest.exists?(localfile), "File got purged") diff --git a/test/types/filesources.rb b/test/types/filesources.rb index c1c601b59..09036cca0 100755 --- a/test/types/filesources.rb +++ b/test/types/filesources.rb @@ -102,9 +102,9 @@ class TestFileSources < Test::Unit::TestCase assert_equal("file", result[:type]) assert(result[:checksum], "did not get value for checksum") if Puppet::SUIDManager.uid == 0 - assert(result.has_key?("owner"), "Lost owner in describe") + assert(result.has_key?(:owner), "Lost owner in describe") else - assert(! result.has_key?("owner"), + assert(! result.has_key?(:owner), "Kept owner in describe even tho not root") end diff --git a/test/types/host.rb b/test/types/host.rb index a68e46020..280959c45 100755 --- a/test/types/host.rb +++ b/test/types/host.rb @@ -92,7 +92,18 @@ class TestHost < Test::Unit::TestCase end def test_moddinghost + # We want to actually use the netinfo provider on darwin + if Facter.value(:operatingsystem) == "Darwin" + Puppet::Type.type(:host).defaultprovider = nil + end host = mkhost() + if Facter.value(:operatingsystem) == "Darwin" + assert_equal(:netinfo, host[:provider], "Got incorrect provider") + end + cleanup do + host[:ensure] = :absent + assert_apply(host) + end assert_events([:host_created], host) @@ -107,7 +118,14 @@ class TestHost < Test::Unit::TestCase host.retrieve - assert_equal(%w{madstop kirby yayness}, host.is(:alias)) + if Facter.value(:operatingsystem) == "Darwin" + # Netinfo can't handle arrays right now + assert_equal(%w{madstop}, host.is(:alias)) + else + assert_equal(%w{madstop kirby yayness}, host.is(:alias)) + end + host[:ensure] = :absent + assert_events([:host_removed], host) end end diff --git a/test/types/type.rb b/test/types/type.rb index aa37f2a18..e8a4d45f1 100755 --- a/test/types/type.rb +++ b/test/types/type.rb @@ -752,11 +752,12 @@ end def test_ref path = tempfile() + Puppet::Type.type(:exec) # uggh, the methods need to load the types file = Puppet::Type.newfile(:path => path) assert_equal("File[#{path}]", file.ref) exec = Puppet::Type.newexec(:title => "yay", :command => "/bin/echo yay") - assert_equal("exec[yay]", exec.ref) + assert_equal("Exec[yay]", exec.ref) end def test_noop_metaparam |
