summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-01-28 17:09:25 -0800
committerJames Turnbull <james@lovedthanlost.net>2010-02-04 00:34:12 +1100
commit6416f91d107947fd2567ae6f6d20493e17aeacbb (patch)
tree37c83f9119083528e964f433af6fec64d43a492c /spec
parent8a3a2056c82c7d0313a052fef00d3a8f039fe0db (diff)
downloadpuppet-6416f91d107947fd2567ae6f6d20493e17aeacbb.tar.gz
puppet-6416f91d107947fd2567ae6f6d20493e17aeacbb.tar.xz
puppet-6416f91d107947fd2567ae6f6d20493e17aeacbb.zip
Fixing #2669 puppetmasterd integration has leaky state
This patches two leaks in the puppetmasterd integration tests that were preventing the script from succesfully connecting to its child puppetmasterd process more than once: 1) a race condition in shutting down puppetmasterd before restarting it 2) holding onto stale SSH certificate information. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/integration/bin/puppetmasterd.rb29
1 files changed, 20 insertions, 9 deletions
diff --git a/spec/integration/bin/puppetmasterd.rb b/spec/integration/bin/puppetmasterd.rb
index 27b0f52bf..f1d77eff5 100755
--- a/spec/integration/bin/puppetmasterd.rb
+++ b/spec/integration/bin/puppetmasterd.rb
@@ -16,6 +16,10 @@ describe "puppetmasterd" do
Puppet[:certdnsnames] = "localhost"
@@port = 12345
+
+ Puppet::SSL::Host.instance_eval{
+ @value_cache = {}
+ }
end
after {
@@ -48,7 +52,7 @@ describe "puppetmasterd" do
f.puts { "notify { testing: }" }
end
- args = arguments + addl_args
+ args = arguments + " " + addl_args
bin = File.join(File.dirname(__FILE__), "..", "..", "..", "sbin", "puppetmasterd")
lib = File.join(File.dirname(__FILE__), "..", "..", "..", "lib")
@@ -56,9 +60,22 @@ describe "puppetmasterd" do
end
def stop
- if @pidfile and FileTest.exist?(@pidfile)
+ if @pidfile and File.exist?(@pidfile)
pid = File.read(@pidfile).chomp.to_i
Process.kill(:TERM, pid)
+ 10.times do
+ break unless File.exist?(@pidfile)
+ sleep 1
+ end
+ begin
+ # sigkill and report if process was still running
+ Process.kill(:KILL, pid)
+
+ raise "Process didn't die from SIGTERM after 10 seconds"
+ rescue Errno::ESRCH
+ # process wasn't running. good.
+ end
+
end
end
@@ -73,16 +90,10 @@ describe "puppetmasterd" do
it "should be serving status information over xmlrpc" do
start
- sleep 5
+ sleep 6
client = Puppet::Network::Client.status.new(:Server => "localhost", :Port => @@port)
- FileUtils.mkdir_p(File.dirname(Puppet[:autosign]))
- File.open(Puppet[:autosign], "w") { |f|
- f.puts Puppet[:certname]
- }
-
- client.cert
retval = client.status
retval.should == 1