diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-07-21 20:11:13 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-07-21 20:11:13 +0000 |
| commit | 310b3a11eec563c4687041f9ae1a0b894571bc05 (patch) | |
| tree | ebaf6941383ae7c2616f59258c0e95c83eb21044 /test | |
| parent | c8537a51c61290c9ba32d57fed31b389dbbdeb29 (diff) | |
Adding timeout functionality to the ParsedFile class, in preparation to adding config reloading to the Config class.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1419 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/other/config.rb | 3 | ||||
| -rwxr-xr-x | test/other/parsedfile.rb | 29 |
2 files changed, 31 insertions, 1 deletions
diff --git a/test/other/config.rb b/test/other/config.rb index 9f941af4e..2b3c985a4 100755 --- a/test/other/config.rb +++ b/test/other/config.rb @@ -694,6 +694,9 @@ inttest = 27 "%s got created as wrong type" % value.inspect) end end + + def test_reparse + end end # $Id$ diff --git a/test/other/parsedfile.rb b/test/other/parsedfile.rb index e343e5478..2f87308ab 100755 --- a/test/other/parsedfile.rb +++ b/test/other/parsedfile.rb @@ -12,6 +12,7 @@ require 'test/unit' class TestParsedFile < Test::Unit::TestCase include TestPuppet def test_file + Puppet[:filetimeout] = 0 file = nil path = tempfile() File.open(path, "w") { |f| f.puts "yayness" } @@ -21,11 +22,37 @@ class TestParsedFile < Test::Unit::TestCase assert(!file.changed?, "File incorrectly returned changed") - sleep(1) + #sleep(1) File.open(path, "w") { |f| f.puts "booness" } + file.send("tstamp=".intern, File.stat(path).ctime - 5) assert(file.changed?, "File did not catch change") end + + def test_timeout + Puppet[:filetimeout] = 50 + path = tempfile() + + File.open(path, "w") { |f| f.puts "yay" } + file = nil + assert_nothing_raised { + file = Puppet::ParsedFile.new(path) + } + + assert_nothing_raised { file.changed? } + + File.open(path, "w") { |f| f.puts "yay" } + file.send("tstamp=".intern, File.stat(path).ctime - 5) + + assert(!file.changed?, + "File was marked as changed too soon") + + Puppet[:filetimeout] = 0 + assert(file.changed?, + "File was not marked as changed soon enough") + + + end end # $Id$ |
