aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-11-02 13:21:22 +0000
committerJamis Buck <jamis@37signals.com>2005-11-02 13:21:22 +0000
commit49cd52a93febcef28a5ae2ed5427294ec5159548 (patch)
treefbcedb4af385c55c4b06f08c822ae5ba54db8803 /railties/test
parenta52132af587efa9bc9cefe3394499a681418c37e (diff)
downloadrails-49cd52a93febcef28a5ae2ed5427294ec5159548.tar.gz
rails-49cd52a93febcef28a5ae2ed5427294ec5159548.tar.bz2
rails-49cd52a93febcef28a5ae2ed5427294ec5159548.zip
Make fcgi handler respond to TERM signals with an explicit exit
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2847 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/fcgi_dispatcher_test.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/railties/test/fcgi_dispatcher_test.rb b/railties/test/fcgi_dispatcher_test.rb
index 2a88e91ea5..cc96c2934c 100644
--- a/railties/test/fcgi_dispatcher_test.rb
+++ b/railties/test/fcgi_dispatcher_test.rb
@@ -30,6 +30,10 @@ class RailsFCGIHandler
def restore!
@reloaded = true
end
+
+ def reload!
+ @reloaded = true
+ end
alias_method :old_run_gc!, :run_gc!
def run_gc!
@@ -62,7 +66,7 @@ class RailsFCGIHandlerTest < Test::Unit::TestCase
@handler.send_signal("HUP")
@handler.thread.join
assert_nil @handler.exit_code
- assert_nil @handler.when_ready
+ assert_equal :reload, @handler.when_ready
assert @handler.reloaded
end
@@ -74,6 +78,7 @@ class RailsFCGIHandlerTest < Test::Unit::TestCase
@handler.thread.join
assert_nil @handler.exit_code
assert_equal :reload, @handler.when_ready
+ assert @handler.reloaded
end
def test_interrupted_via_USR1_when_not_in_request
@@ -95,6 +100,16 @@ class RailsFCGIHandlerTest < Test::Unit::TestCase
assert_nil @handler.exit_code
assert_equal :exit, @handler.when_ready
end
+
+ def test_interrupted_via_TERM
+ Dispatcher.time_to_sleep = 1
+ @handler.thread = Thread.new { @handler.process! }
+ sleep 0.1 # let the thread get started
+ @handler.send_signal("TERM")
+ @handler.thread.join
+ assert_equal 0, @handler.exit_code
+ assert_nil @handler.when_ready
+ end
%w(RuntimeError SignalException).each do |exception|
define_method("test_#{exception}_in_fcgi") do