diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-07-03 16:22:42 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-07-03 16:22:42 +0000 |
| commit | 25cf31b00057d552fcffde568049e37655c31fbc (patch) | |
| tree | 15240e76c8e06a38141362a63b81793260884335 /test | |
| parent | c899e2327b35f09f8061607bbb3b7c732500c5ba (diff) | |
| download | puppet-25cf31b00057d552fcffde568049e37655c31fbc.tar.gz puppet-25cf31b00057d552fcffde568049e37655c31fbc.tar.xz puppet-25cf31b00057d552fcffde568049e37655c31fbc.zip | |
Adding minimal update checking for templates. It will only check the templates that have been parsed in this process, but it is better than nothing.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1353 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/language/functions.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/language/functions.rb b/test/language/functions.rb index ae4b115ea..1ee7ccf8e 100755 --- a/test/language/functions.rb +++ b/test/language/functions.rb @@ -193,6 +193,52 @@ class TestLangFunctions < Test::Unit::TestCase ast.evaluate(:scope => scope) end end + + def test_template_reparses + template = tempfile() + + File.open(template, "w") do |f| + f.puts "original text" + end + + manifest = tempfile() + file = tempfile() + File.open(manifest, "w") do |f| + f.puts %{file { "#{file}": content => template("#{template}") }} + end + + interpreter = Puppet::Parser::Interpreter.new( + :Manifest => manifest, + :UseNodes => false + ) + + parsedate = interpreter.parsedate() + + objects = nil + assert_nothing_raised { + objects = interpreter.run("myhost", {}) + } + + fileobj = objects[0] + + assert_equal("original text\n", fileobj["content"], + "Template did not work") + + # Have to sleep because one second is the fs's time granularity. + sleep(1) + + # Now modify the template + File.open(template, "w") do |f| + f.puts "new text" + end + + assert_nothing_raised { + objects = interpreter.run("myhost", {}) + } + newdate = interpreter.parsedate() + + assert(parsedate != newdate, "Parse date did not change") + end end # $Id$ |
