diff options
author | Luke Kanies <luke@madstop.com> | 2009-07-23 16:51:22 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-07-25 12:00:02 +1000 |
commit | b3b76dffdd9cd8ed5c3d0230624bf05015bec5b8 (patch) | |
tree | 169d9be6b86aa460f1a563c2821874ddb12cc974 /test | |
parent | 9120712f97c12dad0c743271b4f64cf545319b69 (diff) | |
download | puppet-b3b76dffdd9cd8ed5c3d0230624bf05015bec5b8.tar.gz puppet-b3b76dffdd9cd8ed5c3d0230624bf05015bec5b8.tar.xz puppet-b3b76dffdd9cd8ed5c3d0230624bf05015bec5b8.zip |
Fixing #2296 - overlapping recursions work again
This fixes the behaviour when you have file recursions
that overlap - we again correctly use the most
specific information.
It's still a bit expensive when you do this, but
at least it behaves correctly, and it should be
a rare circumstance.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'test')
-rwxr-xr-x | test/other/overrides.rb | 101 | ||||
-rwxr-xr-x | test/ral/type/file.rb | 1 |
2 files changed, 1 insertions, 101 deletions
diff --git a/test/other/overrides.rb b/test/other/overrides.rb deleted file mode 100755 index 22c3d2ac1..000000000 --- a/test/other/overrides.rb +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env ruby - -require File.dirname(__FILE__) + '/../lib/puppettest' - -require 'puppet' -require 'puppettest' - -class TestOverrides < Test::Unit::TestCase - include PuppetTest - def mksubdirs(basedir, level) - @@tmpfiles << basedir - dir = basedir.dup - - (level + 1).times { |index| - Dir.mkdir(dir) - path = File.join(dir, "file") - File.open(path, "w") { |f| f.puts "yayness" } - dir = File.join(dir, index.to_s) - } - end - - def test_simpleoverride - basedir = File.join(tmpdir(), "overridetesting") - mksubdirs(basedir, 1) - - basefile = File.join(basedir, "file") - baseobj = Puppet::Type.type(:file).new( - :title => "base", - :path => basedir, - :recurse => true, - :mode => "755" - ) - - subdir = File.join(basedir, "0") - subfile = File.join(subdir, "file") - subobj = Puppet::Type.type(:file).new( - :title => "sub", - :path => subdir, - :recurse => true, - :mode => "644" - ) - - assert_apply(baseobj, subobj) - - assert_equal(0755, File.stat(basefile).mode & 007777, "Did not set base mode") - assert_equal(0644, File.stat(subfile).mode & 007777, "Did not set overridden mode") - end - - def test_deepoverride - basedir = File.join(tmpdir(), "deepoverridetesting") - mksubdirs(basedir, 10) - - baseobj = nil - assert_nothing_raised("Could not create base obj") { - baseobj = Puppet::Type.type(:file).new( - :path => basedir, - :recurse => true, - :mode => "755" - ) - } - - children = [] - files = {} - subdir = basedir.dup - mode = nil - 10.times { |index| - next unless index % 3 - subdir = File.join(subdir, index.to_s) - path = File.join(subdir, "file") - if index % 2 - mode = "644" - files[path] = 0644 - else - mode = "750" - files[path] = 0750 - end - - assert_nothing_raised("Could not create sub obj") { - children << Puppet::Type.type(:file).new( - :path => subdir, - :recurse => true, - :mode => mode - ) - } - } - - config = mk_catalog(baseobj, *children) - - assert_nothing_raised("Could not eval component") { - config.apply - } - - files.each { |path, mode| - assert(FileTest.exists?(path), "File %s does not exist" % path) - curmode = File.stat(path).mode & 007777 - assert(curmode == mode, - "File %s was incorrect mode %o instead of %o" % [path, curmode, mode]) - } - end -end - diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb index 829310ed4..7d6ec659f 100755 --- a/test/ral/type/file.rb +++ b/test/ral/type/file.rb @@ -5,6 +5,7 @@ require File.dirname(__FILE__) + '/../../lib/puppettest' require 'puppettest' require 'puppettest/support/utils' require 'fileutils' +require 'mocha' class TestFile < Test::Unit::TestCase include PuppetTest::Support::Utils |