summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-08-02 17:50:54 -0700
committerLuke Kanies <luke@madstop.com>2009-08-03 15:02:56 -0700
commit488e368efcb0ad6d896743edb76088242c58fb05 (patch)
tree151f3cc4f145fea9f774f9eb83504da042322c32 /test
parentf1406bfbedc593033f0c46241ec34fdc3bfdfbd2 (diff)
downloadpuppet-488e368efcb0ad6d896743edb76088242c58fb05.tar.gz
puppet-488e368efcb0ad6d896743edb76088242c58fb05.tar.xz
puppet-488e368efcb0ad6d896743edb76088242c58fb05.zip
Adding integration tests for #2371 (backup refactor)
Also removed old conflicting file tests. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/ral/type/file.rb119
1 files changed, 0 insertions, 119 deletions
diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb
index 7d6ec659f..69a893e31 100755
--- a/test/ral/type/file.rb
+++ b/test/ral/type/file.rb
@@ -817,125 +817,6 @@ class TestFile < Test::Unit::TestCase
end
end
- # Testing #304
- def test_links_to_directories
- link = tempfile()
- file = tempfile()
- dir = tempfile()
- Dir.mkdir(dir)
-
- bucket = Puppet::Type.type(:filebucket).new :name => "main"
- File.symlink(dir, link)
- File.open(file, "w") { |f| f.puts "" }
- assert_equal(dir, File.readlink(link))
- obj = Puppet::Type.newfile :path => link, :ensure => :link, :target => file, :recurse => false, :backup => "main"
-
- catalog = mk_catalog(bucket, obj)
-
- catalog.apply
-
- assert_equal(file, File.readlink(link))
- end
-
- # Testing #303
- def test_nobackups_with_links
- link = tempfile()
- new = tempfile()
-
- File.open(link, "w") { |f| f.puts "old" }
- File.open(new, "w") { |f| f.puts "new" }
- obj = Puppet::Type.newfile :path => link, :ensure => :link,
- :target => new, :recurse => true, :backup => false
-
- assert_nothing_raised do
- obj.handlebackup
- end
-
- bfile = [link, "puppet-bak"].join(".")
-
- assert(! FileTest.exists?(bfile), "Backed up when told not to")
-
- assert_apply(obj)
-
- assert(! FileTest.exists?(bfile), "Backed up when told not to")
- end
-
- # Make sure we consistently handle backups for all cases.
- def test_ensure_with_backups
- # We've got three file types, so make sure we can replace any type
- # with the other type and that backups are done correctly.
- types = [:file, :directory, :link]
-
- dir = tempfile()
- path = File.join(dir, "test")
- linkdest = tempfile()
- creators = {
- :file => proc { File.open(path, "w") { |f| f.puts "initial" } },
- :directory => proc { Dir.mkdir(path) },
- :link => proc { File.symlink(linkdest, path) }
- }
-
- bucket = Puppet::Type.type(:filebucket).new :name => "main", :path => tempfile()
-
- obj = Puppet::Type.newfile :path => path, :force => true,
- :links => :manage
-
- catalog = mk_catalog(obj, bucket)
-
- Puppet[:trace] = true
- ["main", false].each do |backup|
- obj[:backup] = backup
- obj.finish
- types.each do |should|
- types.each do |is|
- # It makes no sense to replace a directory with a directory
- # next if should == :directory and is == :directory
-
- Dir.mkdir(dir)
-
- # Make the thing
- creators[is].call
-
- obj[:ensure] = should
-
- if should == :link
- obj[:target] = linkdest
- else
- if obj.property(:target)
- obj.delete(:target)
- end
- end
-
- # First try just removing the initial data
- assert_nothing_raised do
- obj.remove_existing(should)
- end
-
- unless is == should
- # Make sure the original is gone
- assert(! FileTest.exists?(obj[:path]),
- "remove_existing did not work: " +
- "did not remove %s with %s" % [is, should])
- end
- FileUtils.rmtree(obj[:path])
-
- # Now make it again
- creators[is].call
-
- property = obj.property(:ensure)
-
- currentvalue = property.retrieve
- unless property.insync?(currentvalue)
- assert_nothing_raised do
- property.sync
- end
- end
- FileUtils.rmtree(dir)
- end
- end
- end
- end
-
if Process.uid == 0
# Testing #364.
def test_writing_in_directories_with_no_write_access