Skip to content

Commit

Permalink
test_supervisor: Check response of RPC server
Browse files Browse the repository at this point in the history
Signed-off-by: Takuro Ashie <[email protected]>
  • Loading branch information
ashie committed Dec 14, 2020
1 parent b6ab3fa commit f4a368a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/test_supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def test_rpc_server
server.run_rpc_server

sv.send(:install_main_process_signal_handlers)
Net::HTTP.get URI.parse('http://127.0.0.1:24447/api/plugins.flushBuffers')
response = Net::HTTP.get(URI.parse('http://127.0.0.1:24447/api/plugins.flushBuffers'))
info_msg = '[info]: force flushing buffered events' + "\n"

server.stop_rpc_server
Expand All @@ -243,6 +243,7 @@ def test_rpc_server
# This test will be passed in such environment.
pend unless $log.out.logs.first

assert_equal('{"ok":true}', response)
assert{ $log.out.logs.first.end_with?(info_msg) }
ensure
$log.out.reset if $log.out.is_a?(Fluent::Test::DummyLogDevice)
Expand Down Expand Up @@ -275,9 +276,10 @@ def server.config
server.run_rpc_server

mock(server).restart(true) { nil }
Net::HTTP.get URI.parse('http://127.0.0.1:24447/api/plugins.flushBuffers')
response = Net::HTTP.get(URI.parse('http://127.0.0.1:24447/api/plugins.flushBuffers'))

server.stop_rpc_server
assert_equal('{"ok":true}', response)
end

def test_load_config
Expand Down

0 comments on commit f4a368a

Please sign in to comment.