public
Rubygem
Description: James Turnbull's Puppet remote
Homepage: http://reductivelabs.com/trac/puppet
Clone URL: git://github.com/jamtur01/puppet.git
Search Repo:
Fixing a cert test to pass on Darwin.

Darwin has a case-insensitive FS, so the test was failing
because it was specifically testing case sensitivity.

Signed-off-by: Luke Kanies <luke@madstop.com>
lak (author)
Mon Jul 21 11:16:08 -0700 2008
commit  d9aa5ab68fb3196f5db526050c440c470b55a5f6
tree    596e39ce1ddb6d62cadc12432a12cae7d72fc229
parent  686ba4d4c21f6f1e073bd845492f2fe3cb4837a2
...
28
29
30
 
31
32
33
...
28
29
30
31
32
33
34
0
@@ -28,6 +28,7 @@ module Puppet::SSLCertificates::Support
0
 
0
         # Define the reading method.
0
         define_method(reader) do
0
+ p Puppet[param]
0
             return nil unless FileTest.exists?(Puppet[param]) or rename_files_with_uppercase(Puppet[param])
0
 
0
             begin
...
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
100
...
79
80
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
0
@@ -79,22 +79,31 @@ class TestCertSupport < Test::Unit::TestCase
0
         end
0
     end
0
 
0
- # Fixing #1382.
0
- def test_uppercase_files_are_renamed_and_read
0
- # Write a key out to disk in a file containing upper-case.
0
- key = OpenSSL::PKey::RSA.new(32)
0
- should_path = Puppet[:hostprivkey]
0
-
0
- dir, file = File.split(should_path)
0
- newfile = file.sub(/^([a-z.]+)\./) { $1.upcase + "."}
0
- upper_path = File.join(dir, newfile)
0
- File.open(upper_path, "w") { |f| f.print key.to_s }
0
-
0
- user = CertUser.new
0
-
0
- assert_equal(key.to_s, user.read_key.to_s, "Did not read key in from disk")
0
- assert(! FileTest.exist?(upper_path), "Upper case file was not removed")
0
- assert(FileTest.exist?(should_path), "File was not renamed to lower-case file")
0
- assert_equal(key.to_s, user.read_key.to_s, "Did not read key in from disk")
0
+ # Fixing #1382. This test will always fail on Darwin, because its
0
+ # FS is case-insensitive.
0
+ unless Facter.value(:operatingsystem) == "Darwin"
0
+ def test_uppercase_files_are_renamed_and_read
0
+ # Write a key out to disk in a file containing upper-case.
0
+ key = OpenSSL::PKey::RSA.new(32)
0
+ should_path = Puppet[:hostprivkey]
0
+ puts "%s: %s" % [should_path, FileTest.exist?(should_path).inspect]
0
+
0
+ dir, file = File.split(should_path)
0
+ newfile = file.sub(/^([a-z.]+)\./) { $1.upcase + "."}
0
+ puts "%s: %s" % [should_path, FileTest.exist?(should_path).inspect]
0
+ upper_path = File.join(dir, newfile)
0
+ puts "%s: %s" % [should_path, FileTest.exist?(should_path).inspect]
0
+ puts "%s: %s" % [upper_path, FileTest.exist?(upper_path).inspect]
0
+ File.open(upper_path, "w") { |f| f.print key.to_s }
0
+ puts "%s: %s" % [should_path, FileTest.exist?(should_path).inspect]
0
+ puts "%s: %s" % [upper_path, FileTest.exist?(upper_path).inspect]
0
+
0
+ user = CertUser.new
0
+
0
+ assert_equal(key.to_s, user.read_key.to_s, "Did not read key in from disk")
0
+ assert(! FileTest.exist?(upper_path), "Upper case file was not removed")
0
+ assert(FileTest.exist?(should_path), "File was not renamed to lower-case file")
0
+ assert_equal(key.to_s, user.read_key.to_s, "Did not read key in from disk")
0
+ end
0
     end
0
 end

Comments

    No one has commented yet.