diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-02-01 00:12:39 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-02-01 00:12:39 +0000 |
commit | 62ab87309abcbc80d469c68ee210f34f566f42c0 (patch) | |
tree | 83523e94f9d157ebcd94b80f8142734340d8862f /test | |
parent | c8f38b7fee12eefb2bed00681b4952ac7ad3f14f (diff) | |
download | puppet-62ab87309abcbc80d469c68ee210f34f566f42c0.tar.gz puppet-62ab87309abcbc80d469c68ee210f34f566f42c0.tar.xz puppet-62ab87309abcbc80d469c68ee210f34f566f42c0.zip |
Deleting the file even if a source is specified, as mentioned by Robert Nickel.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2138 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-x | test/types/file.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/types/file.rb b/test/types/file.rb index d0a44563d..ff293d2aa 100755 --- a/test/types/file.rb +++ b/test/types/file.rb @@ -950,6 +950,32 @@ class TestFile < Test::Unit::TestCase assert_events([], file) end + # Make sure that content gets used before ensure + def test_deletion_beats_source + dest = tempfile() + source = tempfile() + File.open(source, "w") { |f| f.puts "yay" } + + file = nil + assert_nothing_raised { + file = Puppet.type(:file).create( + :name => dest, + :ensure => :absent, + :source => source + ) + } + + file.retrieve + + assert_events([], file) + assert(! FileTest.exists?(dest), "file was copied during deletion") + + # Now create the dest, and make sure it gets deleted + File.open(dest, "w") { |f| f.puts "boo" } + assert_events([:file_removed], file) + assert(! FileTest.exists?(dest), "file was not deleted during deletion") + end + def test_nameandpath path = tempfile() |