about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-10-19 22:50:10 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-19 22:50:10 +0000
commitb1370f088cad667c34a96c992708d952e23bff03 (patch)
tree675490c5e4eb2ce738049799cd2d8d99ef95d440 /test
parent0bf908cfdcde0731924f1ed6a11c094db8688551 (diff)
downloadyahns-b1370f088cad667c34a96c992708d952e23bff03.tar.gz
We can just add it into the SIGUSR2 test for now.
Diffstat (limited to 'test')
-rw-r--r--test/test_bin.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/test_bin.rb b/test/test_bin.rb
index d21e8b9..8acc91c 100644
--- a/test/test_bin.rb
+++ b/test/test_bin.rb
@@ -147,19 +147,35 @@ class TestBin < Testcase
     assert_equal 200, res.code.to_i
     orig = res.body
     Process.kill(:USR2, pid)
+    newpid = pid
     Timeout.timeout(10) do
       begin
-        sleep 0.01
         newpid = File.read(@pid.path)
       rescue Errno::ENOENT
-      end until newpid.to_i != pid
+      end while newpid.to_i == pid && sleep(0.01)
     end
     Process.kill(:QUIT, pid)
     _, status = Timeout.timeout(10) { Process.waitpid2(pid) }
     assert status.success?, status
     res = Net::HTTP.start(host, port) { |h| h.get("/") }
     assert_equal 200, res.code.to_i
-    refute_equal orig, res.body
+    second = res.body
+    refute_equal orig, second
+
+    newpid = newpid.to_i
+    assert_operator newpid, :>, 0
+    Process.kill(:HUP, newpid)
+    third = second
+    Timeout.timeout(10) do
+      begin
+        third = Net::HTTP.start(host, port) { |h| h.get("/") }.body
+      end while third == second && sleep(0.01)
+    end
+    if worker
+      Process.kill(0, newpid) # nothing should raise
+    else
+      poke_until_dead newpid
+    end
   rescue => e
     Yahns::Log.exception(Logger.new($stderr), "test", e)
     raise