diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-08 07:09:42 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-08 07:09:42 +0000 |
| commit | b6df3369bc8a1dadfab2c7baa6d4572785c075fb (patch) | |
| tree | 78c91084dd33aa0cda93a9ea459c6881c4e1f7b7 /test/util | |
| parent | 0925fb0cd9b7d370a57247b00f402d33f6f0d78b (diff) | |
| download | puppet-b6df3369bc8a1dadfab2c7baa6d4572785c075fb.tar.gz puppet-b6df3369bc8a1dadfab2c7baa6d4572785c075fb.tar.xz puppet-b6df3369bc8a1dadfab2c7baa6d4572785c075fb.zip | |
Looks like [2265] was not a complete solution -- it resulted in failures when the config set modes via integers. Everything is working now, and tested more completely.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2268 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/util')
| -rwxr-xr-x | test/util/config.rb | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/test/util/config.rb b/test/util/config.rb index a3092c6ec..58f74f5c9 100755 --- a/test/util/config.rb +++ b/test/util/config.rb @@ -981,22 +981,50 @@ inttest = 27 # #489 def test_modes Puppet[:name] = "puppet" - file = tempfile config = tempfile() + + check = Proc.new do |string, int| + trans = @config.section_to_transportable(:puppet) + ssldir = trans.find { |o| o.type == "file" } + assert(ssldir, "could not find trans object") + + if ssldir[:mode].is_a?(Fixnum) + assert_equal(int, ssldir[:mode], "mode not set correctly") + else + assert_equal(string, ssldir[:mode], "mode not set correctly") + end + + obj = nil + assert_nothing_raised { obj = ssldir.to_type } + + assert(obj, "did not create object") + assert_equal(int, obj.should(:mode), + "did not pass mode correctly to file") + + obj.class.clear + end + + file = tempfile @config.setdefaults(:puppet, :mode => ["644", "yay"]) - @config.setdefaults(:puppet, :ssldir => ["/some/file", "yay"]) + @config.setdefaults(:puppet, :ssldir => { + :mode => 0644, + :desc => "yay", + :default => "/some/file"}) + + # Convert it first using the number + check.call("644", 0644) + File.open(config, "w") { |f| f.puts "[puppet] - mode = 755 + mode = 750 ssldir = #{file} "} @config.parse(config) - trans = @config.section_to_transportable(:puppet) - ssldir = trans.find { |o| o.type == "file" and o.name == file } - assert(ssldir, "could not find trans object") + assert_equal("750", @config[:mode], + "Did not parse mode correctly") - assert_equal("755", ssldir[:mode], "mode got munged in parsing") + check.call("750", 0750) end end |
