Skip to content

Commit

Permalink
Super basic server test
Browse files Browse the repository at this point in the history
  • Loading branch information
nateberkopec committed Sep 2, 2019
1 parent da55bc5 commit f6397ce
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/test_puma_server.rb
Expand Up @@ -8,7 +8,7 @@ def setup

@app = lambda { |env| [200, {}, [env['rack.url_scheme']]] }

@events = Puma::Events.new STDOUT, STDERR
@events = Puma::Events.strings
@server = Puma::Server.new @app, @events
end

Expand Down Expand Up @@ -279,9 +279,6 @@ def test_GET_with_no_body_has_sane_chunking
end

def test_doesnt_print_backtrace_in_production
@events = Puma::Events.strings
@server = Puma::Server.new @app, @events

@server.app = proc { |e| raise "don't leak me bro" }
@server.leak_stack_on_error = false
@server.add_tcp_listener @host, @port
Expand All @@ -297,7 +294,6 @@ def test_doesnt_print_backtrace_in_production
end

def test_prints_custom_error
@events = Puma::Events.strings
re = lambda { |err| [302, {'Content-Type' => 'text', 'Location' => 'foo.html'}, ['302 found']] }
@server = Puma::Server.new @app, @events, {:lowlevel_error_handler => re}

Expand All @@ -313,7 +309,6 @@ def test_prints_custom_error
end

def test_leh_gets_env_as_well
@events = Puma::Events.strings
re = lambda { |err,env|
env['REQUEST_PATH'] || raise("where is env?")
[302, {'Content-Type' => 'text', 'Location' => 'foo.html'}, ['302 found']]
Expand Down Expand Up @@ -952,4 +947,11 @@ def test_request_body_wait_chunked

assert request_body_wait >= 1000
end

def test_siginfo_prints_thread_traces
@server.log_thread_status
@events.stdout.rewind

assert_match "Thread TID", @events.stdout.read
end
end

0 comments on commit f6397ce

Please sign in to comment.