summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-03-02 20:28:45 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-03-02 20:28:45 +0000
commit343dd08a4ab84bdc6947239e8c514752db219c2a (patch)
tree438f144f98a56ef6e35e4c4b670318f15c81eb31 /test
parent1a93c822667e6990b45f843e56d8976c51517671 (diff)
Fixing tests so they do not chmod /dev/null to 640 (stupid tests).
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@967 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rw-r--r--test/client/client.rb68
-rwxr-xr-xtest/executables/puppetd.rb2
-rwxr-xr-xtest/other/config.rb18
-rwxr-xr-xtest/puppet/utiltest.rb10
-rw-r--r--test/puppettest.rb10
5 files changed, 33 insertions, 75 deletions
diff --git a/test/client/client.rb b/test/client/client.rb
index 659378abd..117d30426 100644
--- a/test/client/client.rb
+++ b/test/client/client.rb
@@ -150,72 +150,4 @@ class TestClient < Test::Unit::TestCase
certbucket.backup("/etc/passwd")
}
end
-
- # disabled because the server needs to have its certs in place
- # in order to start at all
- # i don't think this test makes much sense anyway
- def disabled_test_sslInitWithNonsigningLocalServer
- Puppet[:autosign] = false
- Puppet[:ssldir] = tempfile()
- @@tmpfiles.push Puppet[:ssldir]
-
- file = File.join($puppetbase, "examples", "code", "head")
-
- server = nil
- port = 8086
- assert_nothing_raised {
- server = Puppet::Server.new(
- :Port => port,
- :Handlers => {
- :CA => {}, # so that certs autogenerate
- :Master => {
- :File => file,
- },
- }
- )
- }
-
- spid = fork {
- trap(:INT) { server.shutdown }
- server.start
- }
-
- @@tmppids << spid
- client = nil
- assert_nothing_raised {
- client = Puppet::Client.new(:Server => "localhost", :Port => port)
- }
- certfile = File.join(Puppet[:certdir], [client.fqdn, "pem"].join("."))
- cafile = File.join(Puppet[:certdir], ["ca", "pem"].join("."))
- assert_nil(client.initcerts)
- assert(! File.exists?(certfile))
-
- ca = nil
- assert_nothing_raised {
- ca = Puppet::SSLCertificates::CA.new()
- }
-
-
- csr = nil
- assert_nothing_raised {
- csr = ca.getclientcsr(client.fqdn)
- }
-
- assert(csr)
-
- cert = nil
- assert_nothing_raised {
- cert, cacert = ca.sign(csr)
- File.open(certfile, "w") { |f| f.print cert.to_pem }
- File.open(cafile, "w") { |f| f.print cacert.to_pem }
- }
-
- # this time it should get the cert correctly
- assert_nothing_raised {
- client.initcerts
- }
-
- # this isn't a very good test, since i just wrote the file out
- assert(File.exists?(certfile))
- end
end
diff --git a/test/executables/puppetd.rb b/test/executables/puppetd.rb
index 1ac53db16..4d74782c6 100755
--- a/test/executables/puppetd.rb
+++ b/test/executables/puppetd.rb
@@ -34,7 +34,7 @@ class TestPuppetDExe < Test::Unit::TestCase
# and verify our daemon runs
assert_nothing_raised {
- system cmd
+ system(cmd)
}
sleep 1
assert($? == 0, "Puppetd exited with code %s" % $?)
diff --git a/test/other/config.rb b/test/other/config.rb
index f01aeeaaf..b404f93ad 100755
--- a/test/other/config.rb
+++ b/test/other/config.rb
@@ -478,6 +478,24 @@ yay = /a/path
"Group object is not managed."
)
end
+
+ def test_notmanagingdev
+ c = mkconfig
+ path = "/dev/testing"
+ c.setdefaults(:test,
+ :file => {
+ :default => path,
+ :mode => 0640,
+ :desc => 'yay'
+ }
+ )
+
+ assert_nothing_raised {
+ c.to_component
+ }
+
+ assert(! Puppet.type(:file)["/dev/testing"], "Created dev file")
+ end
end
# $Id$
diff --git a/test/puppet/utiltest.rb b/test/puppet/utiltest.rb
index 68b55b1ff..34278716f 100755
--- a/test/puppet/utiltest.rb
+++ b/test/puppet/utiltest.rb
@@ -144,15 +144,17 @@ class TestPuppetUtil < Test::Unit::TestCase
end
def test_withumask
- File.umask(022)
+ oldmask = File.umask
path = tempfile()
+
+ # FIXME this fails on FreeBSD with a mode of 01777
Puppet::Util.withumask(000) do
- Dir.mkdir(path, 01777)
+ Dir.mkdir(path, 0777)
end
- assert(File.stat(path).mode & 007777 == 01777)
- assert_equal(022, File.umask)
+ assert(File.stat(path).mode & 007777 == 0777, "File has the incorrect mode")
+ assert_equal(oldmask, File.umask, "Umask was not reset")
end
unless Process.uid == 0
diff --git a/test/puppettest.rb b/test/puppettest.rb
index dc1f94def..54dfc1f17 100644
--- a/test/puppettest.rb
+++ b/test/puppettest.rb
@@ -50,8 +50,8 @@ module TestPuppet
$VERBOSE = 1
else
Puppet::Log.close
- Puppet::Log.newdestination "/dev/null"
- Puppet[:httplog] = "/dev/null"
+ Puppet::Log.newdestination tempfile()
+ Puppet[:httplog] = tempfile()
end
Puppet[:ignoreschedules] = true
@@ -120,6 +120,12 @@ module TestPuppet
# Just in case there are processes waiting to die...
Process.waitall
+ if File.stat("/dev/null").mode & 007777 != 0666
+ File.open("/tmp/nullfailure", "w") { |f|
+ f.puts self.class
+ }
+ exit(74)
+ end
end
def tempfile