mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Fix tests
This commit is contained in:
parent
a60ceef5ea
commit
ae5c94f728
2 changed files with 5 additions and 5 deletions
|
@ -293,7 +293,7 @@ module Puma
|
|||
b = server.backlog || 0
|
||||
r = server.running || 0
|
||||
t = server.pool_capacity || 0
|
||||
payload = %Q!#{base_payload}{ "backlog":#{b}, "running":#{r}, "pool_capacity": #{t} }\n!
|
||||
payload = %Q!#{base_payload}{ "backlog":#{b}, "running":#{r}, "pool_capacity":#{t} }\n!
|
||||
io << payload
|
||||
rescue IOError
|
||||
Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue
|
||||
|
|
|
@ -56,8 +56,8 @@ class TestCLI < Minitest::Test
|
|||
s = TCPSocket.new "127.0.0.1", 9877
|
||||
s << "GET /stats HTTP/1.0\r\n\r\n"
|
||||
body = s.read
|
||||
assert_equal '{ "backlog": 0, "running": 0 }', body.split(/\r?\n/).last
|
||||
assert_equal '{ "backlog": 0, "running": 0 }', Puma.stats
|
||||
assert_equal '{ "backlog": 0, "running": 0, "pool_capacity": 16 }', body.split(/\r?\n/).last
|
||||
assert_equal '{ "backlog": 0, "running": 0, "pool_capacity": 16 }', Puma.stats
|
||||
|
||||
cli.launcher.stop
|
||||
t.join
|
||||
|
@ -95,7 +95,7 @@ class TestCLI < Minitest::Test
|
|||
s = UNIXSocket.new @tmp_path
|
||||
s << "GET /stats HTTP/1.0\r\n\r\n"
|
||||
body = s.read
|
||||
assert_match(/\{ "workers": 2, "phase": 0, "booted_workers": 2, "old_workers": 0, "worker_status": \[\{ "pid": \d+, "index": 0, "phase": 0, "booted": true, "last_checkin": "[^"]+", "last_status": \{ "backlog":0, "running":2 \} \},\{ "pid": \d+, "index": 1, "phase": 0, "booted": true, "last_checkin": "[^"]+", "last_status": \{ "backlog":0, "running":2 \} \}\] \}/, body.split("\r\n").last)
|
||||
assert_match(/\{ "workers": 2, "phase": 0, "booted_workers": 2, "old_workers": 0, "worker_status": \[\{ "pid": \d+, "index": 0, "phase": 0, "booted": true, "last_checkin": "[^"]+", "last_status": \{ "backlog":0, "running":2, "pool_capacity":2 \} \},\{ "pid": \d+, "index": 1, "phase": 0, "booted": true, "last_checkin": "[^"]+", "last_status": \{ "backlog":0, "running":2, "pool_capacity":2 \} \}\] \}/, body.split("\r\n").last)
|
||||
|
||||
cli.launcher.stop
|
||||
t.join
|
||||
|
@ -118,7 +118,7 @@ class TestCLI < Minitest::Test
|
|||
s << "GET /stats HTTP/1.0\r\n\r\n"
|
||||
body = s.read
|
||||
|
||||
assert_equal '{ "backlog": 0, "running": 0 }', body.split("\r\n").last
|
||||
assert_equal '{ "backlog": 0, "running": 0, "pool_capacity": 16 }', body.split("\r\n").last
|
||||
|
||||
cli.launcher.stop
|
||||
t.join
|
||||
|
|
Loading…
Reference in a new issue