summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-20 18:10:06 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-20 18:10:06 +0000
commit46824cd8167e2d07ba1f1bdb0cc24789b3a565b1 (patch)
tree17c71d0bcf72eed63652ffa2493a40f4302301b1 /test
parent15905bd5ee0d692e44bed516fe720c278ce67835 (diff)
Setting pluginsync default to false, and (hopefully) fixing autosign problem when the file exists and autosign is set to true (#180). The problem was that the puppetmasterd script was redundantly setting autosign in the CA, when the CA already knows how to deal with autosigning, which meant that autosign was being set before the config was parsed. Thus, there was no bug when autosign was set on the command line but there was when it was set in the config.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1304 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/executables/puppetmasterd.rb4
-rw-r--r--test/puppettest.rb7
-rw-r--r--test/server/ca.rb41
3 files changed, 42 insertions, 10 deletions
diff --git a/test/executables/puppetmasterd.rb b/test/executables/puppetmasterd.rb
index cbf8ac02a..92a8c6b84 100755
--- a/test/executables/puppetmasterd.rb
+++ b/test/executables/puppetmasterd.rb
@@ -74,14 +74,10 @@ class TestPuppetMasterD < Test::Unit::TestCase
)
}
assert_nothing_raised() {
- #Puppet.notice "calling status"
- #retval = client.call("status.status", "")
retval = client.getconfig
}
objects = nil
- stopmasterd
- sleep(1)
end
# verify that we can run puppetmasterd in parse-only mode
diff --git a/test/puppettest.rb b/test/puppettest.rb
index c65c95f49..6bdc41a75 100644
--- a/test/puppettest.rb
+++ b/test/puppettest.rb
@@ -462,6 +462,11 @@ module ExeTest
assert($? == 0, "Puppetmasterd exit status was %s" % $?)
sleep(1)
+ cleanup do
+ stopmasterd
+ sleep(1)
+ end
+
return manifest
end
@@ -483,7 +488,7 @@ module ExeTest
if line =~ /ruby.+puppetmasterd/
next if line =~ /\.rb/ # skip the test script itself
ary = line.sub(/^\s+/, '').split(/\s+/)
- runningpid = ary[1].to_i
+ pid = ary[1].to_i
end
}
diff --git a/test/server/ca.rb b/test/server/ca.rb
index 0009b3d32..b7bad5cd6 100644
--- a/test/server/ca.rb
+++ b/test/server/ca.rb
@@ -21,11 +21,6 @@ end
class TestCA < Test::Unit::TestCase
include ServerTest
- def teardown
- super
- #print "\n\n" if Puppet[:debug]
- end
-
# Verify that we're autosigning. We have to autosign a "different" machine,
# since we always autosign the CA server's certificate.
def test_autocertgeneration
@@ -205,4 +200,40 @@ class TestCA < Test::Unit::TestCase
)
}
end
+
+ # Make sure true/false causes the file to be ignored.
+ def test_autosign_true_beats_file
+ caserv = nil
+ assert_nothing_raised {
+ caserv = Puppet::Server::CA.new()
+ }
+
+ host = "hostname.domain.com"
+
+ # Create an autosign file
+ file = tempfile()
+ Puppet[:autosign] = file
+
+ File.open(file, "w") { |f|
+ f.puts host
+ }
+
+ # Start with "false"
+ Puppet[:autosign] = false
+
+ assert(! caserv.autosign?(host), "Host was incorrectly autosigned")
+
+ # Then set it to true
+ Puppet[:autosign] = true
+ assert(caserv.autosign?(host), "Host was not autosigned")
+ # And try a different host
+ assert(caserv.autosign?("other.yay.com"), "Host was not autosigned")
+
+ # And lastly the file
+ Puppet[:autosign] = file
+ assert(caserv.autosign?(host), "Host was not autosigned")
+
+ # And try a different host
+ assert(! caserv.autosign?("other.yay.com"), "Host was autosigned")
+ end
end