minor: wait for mongod to die when we kill it during replica set tests
This commit is contained in:
parent
dab2552b6b
commit
bcb32e5935
|
@ -173,11 +173,26 @@ class ReplSetManager
|
|||
ensure_up
|
||||
end
|
||||
|
||||
def wait_for_death(pid)
|
||||
@retries.times do
|
||||
if `ps a | grep mongod`.include?("#{pid}")
|
||||
puts "waiting for mongod @ pid #{pid} to die..."
|
||||
sleep(1)
|
||||
else
|
||||
puts "mongod @ pid #{pid} was killed successfully"
|
||||
return true
|
||||
end
|
||||
end
|
||||
puts "mongod never died"
|
||||
return false
|
||||
end
|
||||
|
||||
def kill(node, signal=2)
|
||||
pid = @mongods[node]['pid']
|
||||
puts "** Killing node with pid #{pid} at port #{@mongods[node]['port']}"
|
||||
system("kill #{pid}")
|
||||
@mongods[node]['up'] = false
|
||||
dead = wait_for_death(pid)
|
||||
@mongods[node]['up'] = false if dead
|
||||
end
|
||||
|
||||
def kill_primary(signal=2)
|
||||
|
|
Loading…
Reference in New Issue