mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Update fcgi dispatcher test cases. Closes #11471 [guillaume]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9220 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
940cf0cacd
commit
cfe42ba1b1
1 changed files with 23 additions and 7 deletions
|
@ -59,11 +59,12 @@ class RailsFCGIHandlerTest < Test::Unit::TestCase
|
|||
@handler.process!
|
||||
end
|
||||
|
||||
def test_restart_handler
|
||||
def test_restart_handler_outside_request
|
||||
@handler.expects(:dispatcher_log).with(:info, "asked to restart ASAP")
|
||||
@handler.expects(:restart!).once
|
||||
|
||||
@handler.send(:restart_handler, nil)
|
||||
assert_equal :restart, @handler.when_ready
|
||||
assert_equal nil, @handler.when_ready
|
||||
end
|
||||
|
||||
def test_install_signal_handler_should_log_on_bad_signal
|
||||
|
@ -131,7 +132,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase
|
|||
def test_interrupted_via_HUP_when_not_in_request
|
||||
cgi = mock
|
||||
FCGI.expects(:each_cgi).once.yields(cgi)
|
||||
@handler.expects(:gc_countdown).returns { Process.kill 'HUP', $$ }
|
||||
@handler.expects(:gc_countdown).returns(lambda { Process.kill 'HUP', $$ } )
|
||||
|
||||
@handler.expects(:reload!).once
|
||||
@handler.expects(:close_connection).never
|
||||
|
@ -144,7 +145,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase
|
|||
def test_interrupted_via_HUP_when_in_request
|
||||
cgi = mock
|
||||
FCGI.expects(:each_cgi).once.yields(cgi)
|
||||
Dispatcher.expects(:dispatch).with(cgi).returns { Process.kill 'HUP', $$ }
|
||||
Dispatcher.expects(:dispatch).with(cgi).returns( lambda { Process.kill 'HUP', $$ } )
|
||||
|
||||
@handler.expects(:reload!).once
|
||||
@handler.expects(:close_connection).never
|
||||
|
@ -157,7 +158,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase
|
|||
def test_interrupted_via_USR1_when_not_in_request
|
||||
cgi = mock
|
||||
FCGI.expects(:each_cgi).once.yields(cgi)
|
||||
@handler.expects(:gc_countdown).returns { Process.kill 'USR1', $$ }
|
||||
@handler.expects(:gc_countdown).returns( lambda { Process.kill 'USR1', $$ } )
|
||||
@handler.expects(:exit_handler).never
|
||||
|
||||
@handler.expects(:reload!).never
|
||||
|
@ -171,7 +172,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase
|
|||
def test_interrupted_via_USR1_when_in_request
|
||||
cgi = mock
|
||||
FCGI.expects(:each_cgi).once.yields(cgi)
|
||||
Dispatcher.expects(:dispatch).with(cgi).returns { Process.kill 'USR1', $$ }
|
||||
Dispatcher.expects(:dispatch).with(cgi).returns( lambda { Process.kill 'USR1', $$ } )
|
||||
|
||||
@handler.expects(:reload!).never
|
||||
@handler.expects(:close_connection).with(cgi).once
|
||||
|
@ -181,10 +182,25 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase
|
|||
assert_equal :exit, @handler.when_ready
|
||||
end
|
||||
|
||||
def test_restart_via_USR2_when_in_request
|
||||
cgi = mock
|
||||
FCGI.expects(:each_cgi).once.yields(cgi)
|
||||
@handler.expects(:gc_countdown).returns( lambda { Process.kill 'USR2', $$ } )
|
||||
@handler.expects(:exit_handler).never
|
||||
|
||||
@handler.expects(:reload!).never
|
||||
@handler.expects(:close_connection).with(cgi).once
|
||||
@handler.expects(:exit).never
|
||||
@handler.expects(:restart!).once
|
||||
|
||||
@handler.process!
|
||||
assert_equal :restart, @handler.when_ready
|
||||
end
|
||||
|
||||
def test_interrupted_via_TERM
|
||||
cgi = mock
|
||||
FCGI.expects(:each_cgi).once.yields(cgi)
|
||||
Dispatcher.expects(:dispatch).with(cgi).returns { Process.kill 'TERM', $$ }
|
||||
Dispatcher.expects(:dispatch).with(cgi).returns(lambda { Process.kill 'TERM', $$ })
|
||||
|
||||
@handler.expects(:reload!).never
|
||||
@handler.expects(:close_connection).never
|
||||
|
|
Loading…
Reference in a new issue