diff --git a/test/plugin/test_out_forward.rb b/test/plugin/test_out_forward.rb index 3a7f9a2e10..438caf8fa2 100644 --- a/test/plugin/test_out_forward.rb +++ b/test/plugin/test_out_forward.rb @@ -1248,27 +1248,22 @@ def plugin_id_for_test? target_input_driver = create_target_input_driver(conf: target_config) output_conf = config d = create_driver(output_conf) - d.instance_start - begin - chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil)) - mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port, - linger_timeout: anything, - send_timeout: anything, - recv_timeout: anything, - connect_timeout: anything - ) { |sock| mock(sock).close.once; sock }.twice + chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil)) + mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port, + linger_timeout: anything, + send_timeout: anything, + recv_timeout: anything, + connect_timeout: anything + ) { |sock| mock(sock).close.once; sock }.twice - target_input_driver.run(timeout: 15) do - d.run(shutdown: false) do - node = d.instance.nodes.first - 2.times do - node.send_data('test', chunk) rescue nil - end + target_input_driver.run(timeout: 15) do + d.run do + node = d.instance.nodes.first + 2.times do + node.send_data('test', chunk) rescue nil end end - ensure - d.instance_shutdown end end @@ -1282,7 +1277,6 @@ def plugin_id_for_test? port #{@target_port} ]) - d.instance_start assert_nothing_raised { d.run } end @@ -1294,33 +1288,28 @@ def plugin_id_for_test? keepalive_timeout 2 ] d = create_driver(output_conf) - d.instance_start - begin - chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil)) - mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port, - linger_timeout: anything, - send_timeout: anything, - recv_timeout: anything, - connect_timeout: anything - ) { |sock| mock(sock).close.once; sock }.once + chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil)) + mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port, + linger_timeout: anything, + send_timeout: anything, + recv_timeout: anything, + connect_timeout: anything + ) { |sock| mock(sock).close.once; sock }.once - target_input_driver.run(timeout: 15) do - d.run(shutdown: false) do - node = d.instance.nodes.first - 2.times do - node.send_data('test', chunk) rescue nil - end + target_input_driver.run(timeout: 15) do + d.run do + node = d.instance.nodes.first + 2.times do + node.send_data('test', chunk) rescue nil end end - ensure - d.instance_shutdown end end test 'create timer of purging obsolete sockets' do output_conf = config + %[keepalive true] - d = create_driver(output_conf) + @d = d = create_driver(output_conf) mock(d.instance).timer_execute(:out_forward_heartbeat_request, 1).once mock(d.instance).timer_execute(:out_forward_keep_alived_socket_watcher, 5).once @@ -1336,7 +1325,6 @@ def plugin_id_for_test? keepalive_timeout 2 ] d = create_driver(output_conf) - d.instance_start chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil)) mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port,