Permalink
Browse files

Add test for hot restart with workers

  • Loading branch information...
1 parent e9a0b5e commit 1a19f79be73fb3895977b59f34ec8dbf94fbff12 @evanphx evanphx committed Sep 10, 2012
Showing with 26 additions and 0 deletions.
  1. +26 −0 test/test_integration.rb
@@ -111,6 +111,32 @@ def test_restart_closes_keepalive_sockets
assert_equal "Hello World", s.read.split("\r\n").last
end
+ def test_restart_closes_keepalive_sockets_workers
+ server("-q -w 2 test/hello.ru")
+
+ s = TCPSocket.new "localhost", @tcp_port
+ s << "GET / HTTP/1.1\r\n\r\n"
+ true until s.gets == "\r\n"
+
+ s.readpartial(20)
+ signal :USR2
+
+ true while @server.gets =~ /Ctrl-C/
+ sleep 1
+
+ s.write "GET / HTTP/1.1\r\n\r\n"
+
+ assert_raises Errno::ECONNRESET do
+ Timeout.timeout(2) do
+ s.read(2)
+ end
+ end
+
+ s = TCPSocket.new "localhost", @tcp_port
+ s << "GET / HTTP/1.0\r\n\r\n"
+ assert_equal "Hello World", s.read.split("\r\n").last
+ end
+
def test_bad_query_string_outputs_400
server "-q test/hello.ru 2>&1"

0 comments on commit 1a19f79

Please sign in to comment.