Skip to content

Commit

Permalink
Failing test for #2371
Browse files Browse the repository at this point in the history
The EOF can be triggered by opening a connection, not writing to it, then closing the connection. When this happens we can detect if an error was logged or not by inspecting the stderr string. 

This test fails
  • Loading branch information
schneems committed Sep 25, 2020
1 parent 93bb1d0 commit 8c5ef9b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/test_puma_server.rb
Expand Up @@ -256,6 +256,17 @@ def test_doesnt_print_backtrace_in_production
assert_match(/HTTP\/1.0 500 Internal Server Error/, data)
end


def test_eof_on_connection_close_is_not_logged_as_an_error
server_run

new_connection.close # Make a connection and close without writing

@server.stop(true)
stderr = @events.stderr.string
assert stderr.empty?, "Expected stderr from server to be empty but it was #{stderr.inspect}"
end

def test_force_shutdown_custom_error_message
handler = lambda {|err, env, status| [500, {"Content-Type" => "application/json"}, ["{}\n"]]}
@server = Puma::Server.new @app, @events, {:lowlevel_error_handler => handler, :force_shutdown_after => 2}
Expand Down

0 comments on commit 8c5ef9b

Please sign in to comment.