From ae5c94f728e5fc72c290d6de9c45c7e7744d94cd Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 4 May 2018 13:35:23 -0500 Subject: [PATCH] Fix tests --- lib/puma/cluster.rb | 2 +- test/test_cli.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/puma/cluster.rb b/lib/puma/cluster.rb index 7b6d0c3c..15906cce 100644 --- a/lib/puma/cluster.rb +++ b/lib/puma/cluster.rb @@ -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 diff --git a/test/test_cli.rb b/test/test_cli.rb index 2a34a20a..3acd00bb 100644 --- a/test/test_cli.rb +++ b/test/test_cli.rb @@ -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