mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
add tests
This commit is contained in:
parent
5e5dca7ce0
commit
ac0652f5a1
3 changed files with 37 additions and 0 deletions
1
test/config/suppress_exception.rb
Normal file
1
test/config/suppress_exception.rb
Normal file
|
@ -0,0 +1 @@
|
|||
raise_exception_on_sigterm false
|
|
@ -185,6 +185,17 @@ class TestConfigFile < Minitest::Test
|
|||
assert_equal 150, conf.options[:worker_shutdown_timeout]
|
||||
end
|
||||
|
||||
def test_config_raise_exception_on_sigterm
|
||||
conf = Puma::Configuration.new do |c|
|
||||
c.raise_exception_on_sigterm false
|
||||
end
|
||||
conf.load
|
||||
|
||||
assert_equal conf.options[:raise_exception_on_sigterm], false
|
||||
conf.options[:raise_exception_on_sigterm] = true
|
||||
assert_equal conf.options[:raise_exception_on_sigterm], true
|
||||
end
|
||||
|
||||
def teardown
|
||||
FileUtils.rm_r("config/puma")
|
||||
end
|
||||
|
|
|
@ -264,6 +264,31 @@ class TestIntegration < Minitest::Test
|
|||
assert_equal 15, status
|
||||
end
|
||||
|
||||
def test_term_signal_suppress_in_single_mode
|
||||
skip NO_FORK_MSG unless HAS_FORK
|
||||
|
||||
pid = start_forked_server("-C test/config/suppress_exception.rb test/rackup/hello.ru")
|
||||
_, status = stop_forked_server(pid)
|
||||
|
||||
assert_equal 0, status
|
||||
end
|
||||
|
||||
def test_term_signal_suppress_in_clustered_mode
|
||||
skip NO_FORK_MSG unless HAS_FORK
|
||||
|
||||
server("-w 2 -C test/config/suppress_exception.rb test/rackup/hello.ru")
|
||||
|
||||
Process.kill(:TERM, @server.pid)
|
||||
begin
|
||||
Process.wait @server.pid
|
||||
rescue Errno::ECHILD
|
||||
end
|
||||
status = $?.exitstatus
|
||||
|
||||
assert_equal 0, status
|
||||
@server = nil # prevent `#teardown` from killing already killed server
|
||||
end
|
||||
|
||||
def test_not_accepts_new_connections_after_term_signal
|
||||
skip_on :jruby, :windows
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue