summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-28 07:20:25 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-28 07:20:25 +0000
commitebc4dd231e4970e9d3ccbbe57d0df9f38cf4c1aa (patch)
tree28e6e9e36228f391b7391f33142d4eebe64967f6 /test
parentff9ec47e4b9b13c043c41e5b74a0b0fb82ba8ba5 (diff)
downloadpuppet-ebc4dd231e4970e9d3ccbbe57d0df9f38cf4c1aa.tar.gz
puppet-ebc4dd231e4970e9d3ccbbe57d0df9f38cf4c1aa.tar.xz
puppet-ebc4dd231e4970e9d3ccbbe57d0df9f38cf4c1aa.zip
Fixing #464 and #515.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2244 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/ral/types/file.rb28
1 files changed, 24 insertions, 4 deletions
diff --git a/test/ral/types/file.rb b/test/ral/types/file.rb
index 5b5f19299..57419164b 100755
--- a/test/ral/types/file.rb
+++ b/test/ral/types/file.rb
@@ -1452,7 +1452,7 @@ class TestFile < Test::Unit::TestCase
file = File.join(dirs["other"], "file")
sourcefile = File.join(dirs["source"], "sourcefile")
- link = File.join(dirs["target"], "link")
+ link = File.join(dirs["target"], "sourcefile")
File.open(file, "w") { |f| f.puts "other" }
File.open(sourcefile, "w") { |f| f.puts "source" }
@@ -1460,17 +1460,18 @@ class TestFile < Test::Unit::TestCase
obj = Puppet::Type.type(:file).create(
:path => dirs["target"],
- :ensure => "file",
+ :ensure => :file,
:source => dirs["source"],
:recurse => true
)
- trans = assert_events([:file_created, :file_created], obj)
+ trans = assert_apply(obj)
newfile = File.join(dirs["target"], "sourcefile")
- assert(File.exists?(newfile), "File did not get copied")
+ assert(File.directory?(dirs["target"]), "Dir did not get created")
+ assert(File.file?(newfile), "File did not get copied")
assert_equal(File.read(sourcefile), File.read(newfile),
"File did not get copied correctly.")
@@ -2072,6 +2073,25 @@ class TestFile < Test::Unit::TestCase
assert_equal(Puppet::Type.type(:filebucket)["puppet"].bucket, file.bucket,
"did not default to the 'puppet' filebucket")
end
+
+ # #515 - make sure 'ensure' other than "link" is deleted during recursion
+ def test_ensure_deleted_during_recursion
+ dir = tempfile()
+ Dir.mkdir(dir)
+ file = File.join(dir, "file")
+ File.open(file, "w") { |f| f.puts "asdfasdf" }
+
+ obj = Puppet::Type.newfile(:path => dir, :ensure => :directory,
+ :recurse => true)
+
+ children = nil
+ assert_nothing_raised do
+ children = obj.eval_generate
+ end
+ fobj = obj.class[file]
+ assert(fobj, "did not create file object")
+ assert(fobj.should(:ensure) != :directory, "ensure was passed to child")
+ end
end
# $Id$