minor: wait for mongod to die when we kill it during replica set tests
This commit is contained in:
parent
dab2552b6b
commit
bcb32e5935
|
@ -172,12 +172,27 @@ class ReplSetManager
|
||||||
con.close
|
con.close
|
||||||
ensure_up
|
ensure_up
|
||||||
end
|
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)
|
def kill(node, signal=2)
|
||||||
pid = @mongods[node]['pid']
|
pid = @mongods[node]['pid']
|
||||||
puts "** Killing node with pid #{pid} at port #{@mongods[node]['port']}"
|
puts "** Killing node with pid #{pid} at port #{@mongods[node]['port']}"
|
||||||
system("kill #{pid}")
|
system("kill #{pid}")
|
||||||
@mongods[node]['up'] = false
|
dead = wait_for_death(pid)
|
||||||
|
@mongods[node]['up'] = false if dead
|
||||||
end
|
end
|
||||||
|
|
||||||
def kill_primary(signal=2)
|
def kill_primary(signal=2)
|
||||||
|
|
Loading…
Reference in New Issue