diff options
| author | Luke Kanies <luke@madstop.com> | 2005-07-11 20:51:52 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-07-11 20:51:52 +0000 |
| commit | 75e27cf8f387816526860df3ad0d38ddce8eeb01 (patch) | |
| tree | a9a251e7e28a6573ad654eb7ef94fe29e42fb97a /test | |
| parent | 0417fb59f4493b98fea9b03a60cb21ffc0f8bed4 (diff) | |
cleaning up bugs in the tests, and adding more error checking around the bugs
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@359 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rw-r--r-- | test/types/tc_file.rb | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/test/types/tc_file.rb b/test/types/tc_file.rb index 0b50d94f2..fb95bfbb6 100644 --- a/test/types/tc_file.rb +++ b/test/types/tc_file.rb @@ -26,7 +26,7 @@ class TestFile < Test::Unit::TestCase end def teardown - Puppet::Type::PFile.clear + Puppet::Type.allclear system("rm -f %s" % Puppet[:statefile]) end @@ -126,11 +126,18 @@ class TestFile < Test::Unit::TestCase } end - def test_checksums + def test_xchecksums types = %w{md5 md5lite timestamp ctime} files = %w{/tmp/sumtest} + assert_nothing_raised() { + Puppet::Storage.init + # Puppet::Storage.load + } types.each { |type| files.each { |path| + if Puppet[:debug] + Puppet.info "Testing %s on %s" % [type,path] + end file = nil events = nil assert_nothing_raised() { @@ -166,6 +173,14 @@ class TestFile < Test::Unit::TestCase } #system("cat %s" % path) } + Puppet::Type::PFile.clear + # now recreate the file + assert_nothing_raised() { + file = Puppet::Type::PFile.new( + :path => path, + :checksum => type + ) + } assert_nothing_raised() { file.evaluate } @@ -184,11 +199,15 @@ class TestFile < Test::Unit::TestCase } } } + # clean up so i don't screw up other tests + Puppet::Storage.clear end def cyclefile(path) file = nil changes = nil + comp = nil + trans = nil assert_nothing_raised { file = Puppet::Type::PFile.new( :path => path, @@ -196,15 +215,20 @@ class TestFile < Test::Unit::TestCase :checksum => "md5" ) } + comp = Puppet::Component.new( + :name => "component" + ) + comp.push file assert_nothing_raised { - changes = file.evaluate + trans = comp.evaluate } - changes.each { |change| - change.go + assert_nothing_raised { + trans.evaluate } #assert_nothing_raised { # file.sync #} + Puppet::Type.allclear end def test_recursion @@ -212,17 +236,14 @@ class TestFile < Test::Unit::TestCase tmpfile = File.join(path,"testing") system("mkdir -p #{path}") cyclefile(path) - Puppet::Type::PFile.clear File.open(tmpfile, File::WRONLY|File::CREAT|File::APPEND) { |of| of.puts "yayness" } cyclefile(path) - Puppet::Type::PFile.clear File.open(tmpfile, File::WRONLY|File::APPEND) { |of| of.puts "goodness" } cyclefile(path) - Puppet::Type::PFile.clear system("rm -rf #{path}") end end |
