summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-07-22 04:39:11 +0000
committerLuke Kanies <luke@madstop.com>2005-07-22 04:39:11 +0000
commit326b4ade1a41f6c876ecc9d5a291c309776c6a10 (patch)
treec87ef65a4b78be3fdc95b408a08e2ff068f76bc6
parentfa6569dcf725b0c53cb76236d2700657e304395d (diff)
downloadpuppet-326b4ade1a41f6c876ecc9d5a291c309776c6a10.tar.gz
puppet-326b4ade1a41f6c876ecc9d5a291c309776c6a10.tar.xz
puppet-326b4ade1a41f6c876ecc9d5a291c309776c6a10.zip
fixing exec tests to work with new event stuff
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@437 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xtest/types/tc_exec.rb31
1 files changed, 27 insertions, 4 deletions
diff --git a/test/types/tc_exec.rb b/test/types/tc_exec.rb
index 42256dbcb..877078d31 100755
--- a/test/types/tc_exec.rb
+++ b/test/types/tc_exec.rb
@@ -13,10 +13,16 @@ require 'facter'
class TestExec < Test::Unit::TestCase
def setup
Puppet[:loglevel] = :debug if __FILE__ == $0
+ @@tmpfiles = []
end
def teardown
Puppet::Type.allclear
+ @@tmpfiles.each { |f|
+ if FileTest.exists?(f)
+ system("rm -rf %s" % f)
+ end
+ }
end
def test_execution
@@ -142,10 +148,11 @@ class TestExec < Test::Unit::TestCase
def test_refreshonly
file = nil
cmd = nil
- tmpfile = "/tmp/testing"
+ tmpfile = "/tmp/exectesting"
+ @@tmpfiles.push tmpfile
trans = nil
- File.open(tmpfile, File::WRONLY|File::CREAT|File::APPEND) { |of|
- of.puts "yayness"
+ File.open(tmpfile, File::WRONLY|File::CREAT|File::TRUNC) { |of|
+ of.puts rand(100)
}
file = Puppet::Type::PFile.new(
:path => tmpfile,
@@ -168,6 +175,22 @@ class TestExec < Test::Unit::TestCase
}
events = nil
assert_nothing_raised {
+ trans = comp.evaluate
+ events = trans.evaluate.collect { |event|
+ event.event
+ }
+ }
+ # the first checksum shouldn't result in a changed file
+ assert_equal([],events)
+ File.open(tmpfile, File::WRONLY|File::CREAT|File::TRUNC) { |of|
+ of.puts rand(100)
+ of.puts rand(100)
+ of.puts rand(100)
+ }
+ assert_nothing_raised {
+ trans = comp.evaluate
+ }
+ assert_nothing_raised {
events = trans.evaluate.collect { |event|
event.event
}
@@ -176,7 +199,7 @@ class TestExec < Test::Unit::TestCase
# verify that only the file_changed event was kicked off, not the
# command_executed
assert_equal(
- ["file_changed"],
+ [:file_modified],
events
)
end