diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-05-18 22:16:03 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-05-18 22:16:03 +0000 |
| commit | 5671ce8bbc6eb75664190a7a2fe4b195ee31d4b7 (patch) | |
| tree | ad60e819920884794907d3cdca673895ebaf36d2 /test | |
| parent | b3ea53cd99df84a93fe2f093d2224e711f49e5dd (diff) | |
Added the last of the tests for the runner, along with the necessary work in puppetd to be able to start it.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1213 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/server/runner.rb | 72 |
1 files changed, 52 insertions, 20 deletions
diff --git a/test/server/runner.rb b/test/server/runner.rb index 7f362dc17..19c08e558 100755 --- a/test/server/runner.rb +++ b/test/server/runner.rb @@ -36,11 +36,18 @@ class TestServerRunner < Test::Unit::TestCase end def test_runner + Puppet[:ignoreschedules] = false # Okay, make our manifest file = tempfile() created = tempfile() File.open(file, "w") do |f| - f.puts %{file { "#{created}": ensure => file }} + f.puts %{ + class yayness { + file { "#{created}": ensure => file, schedule => weekly } + } + + include yayness + } end client = mkclient(file) @@ -49,25 +56,50 @@ class TestServerRunner < Test::Unit::TestCase assert_nothing_raised { runner = Puppet::Server::Runner.new } - - assert_nothing_raised { - # Try it without backgrounding - runner.run(nil, nil, false) - } - - assert(FileTest.exists?(created), "File did not get created") - - # Now background it - File.unlink(created) - - assert_nothing_raised { - runner.run(nil, nil, true) - } - - Puppet.join - - assert(FileTest.exists?(created), "File did not get created") - + # First: tags + # Second: ignore schedules true/false + # Third: background true/false + # Fourth: whether file should exist true/false + [ + ["with no backgrounding", + nil, true, false, true], # no backgrounding + ["in the background", + nil, true, true, true], # in the background + ["with a bad tag", + ["coolness"], true, true, false], # a bad tag + ["with another bad tag", + "coolness", true, true, false], # another bad tag + ["with a good tag", + ["coolness", "yayness"], true, true, true], # a good tag + ["with another good tag", + ["yayness"], true, true, true], # another good tag + ["with a third good tag", + "yayness", true, true, true], # another good tag + ["not ignoring schedules", + nil, false, true, false], # do not ignore schedules + ["ignoring schedules", + nil, true, true, true], # ignore schedules + ].each do |msg, tags, ignore, bg, shouldexist| + if FileTest.exists?(created) + File.unlink(created) + end + assert_nothing_raised { + # Try it without backgrounding + runner.run(tags, ignore, bg) + } + + if bg + Puppet.join + end + + if shouldexist + assert(FileTest.exists?(created), "File did not get created " + + msg) + else + assert(!FileTest.exists?(created), "File got created incorrectly " + + msg) + end + end end end |
