1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

add tests

This commit is contained in:
Michał Kulesza 2019-02-21 21:31:35 +01:00
parent 5e5dca7ce0
commit ac0652f5a1
3 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1 @@
raise_exception_on_sigterm false

View file

@ -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

View file

@ -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