From 24d8b793780c789bdaefadf0338de8719d04ae5f Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Sat, 19 Feb 2022 01:23:00 +0900 Subject: [PATCH] test_out_forward: Use assert_rr For avoiding the following error: ``` 2022-02-18T01:36:00.3691879Z =============================================================================== 2022-02-18T01:36:00.3692453Z Failure: test: send tags in str (utf-8 strings)(ForwardOutputTest): 2022-02-18T01:36:00.3692799Z On subject , 2022-02-18T01:36:00.3693302Z unexpected method invocation: 2022-02-18T01:36:00.3693595Z process_wait(2088, 0) 2022-02-18T01:36:00.3702794Z expected invocations: 2022-02-18T01:36:00.3703495Z C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.5/lib/serverengine/socket_manager.rb:79:in ``' 2022-02-18T01:36:00.3704338Z C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.5/lib/serverengine/socket_manager.rb:79:in `block in generate_path' 2022-02-18T01:36:00.3705025Z C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.5/lib/serverengine/socket_manager.rb:78:in `each' 2022-02-18T01:36:00.3705695Z C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.5/lib/serverengine/socket_manager.rb:78:in `generate_path' 2022-02-18T01:36:00.3706156Z D:/a/fluentd/fluentd/lib/fluent/test/driver/base.rb:105:in `instance_start' 2022-02-18T01:36:00.3706550Z D:/a/fluentd/fluentd/lib/fluent/test/driver/base.rb:77:in `run' 2022-02-18T01:36:00.3706945Z D:/a/fluentd/fluentd/lib/fluent/test/driver/base_owner.rb:130:in `run' 2022-02-18T01:36:00.3707422Z D:/a/fluentd/fluentd/test/plugin/test_out_forward.rb:434:in `block in ' 2022-02-18T01:36:00.3707780Z 431: ] 2022-02-18T01:36:00.3708021Z 432: 2022-02-18T01:36:00.3708366Z 433: stub(d.instance.ack_handler).read_ack_from_sock(anything).never 2022-02-18T01:36:00.3708758Z => 434: target_input_driver.run(expect_records: 2) do 2022-02-18T01:36:00.3709053Z 435: d.run do 2022-02-18T01:36:00.3709364Z 436: emit_events.each do |tag, t, record| 2022-02-18T01:36:00.3709681Z 437: d.feed(tag, t, record) 2022-02-18T01:36:00.3709997Z =============================================================================== ``` Signed-off-by: Takuro Ashie --- test/plugin/test_out_forward.rb | 50 ++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/test/plugin/test_out_forward.rb b/test/plugin/test_out_forward.rb index 53aca518c2..66a2776cc5 100644 --- a/test/plugin/test_out_forward.rb +++ b/test/plugin/test_out_forward.rb @@ -431,10 +431,12 @@ def try_write(chunk) ] stub(d.instance.ack_handler).read_ack_from_sock(anything).never - target_input_driver.run(expect_records: 2) do - d.run do - emit_events.each do |tag, t, record| - d.feed(tag, t, record) + assert_rr do + target_input_driver.run(expect_records: 2) do + d.run do + emit_events.each do |tag, t, record| + d.feed(tag, t, record) + end end end end @@ -461,10 +463,12 @@ def try_write(chunk) ] stub(d.instance.ack_handler).read_ack_from_sock(anything).never - target_input_driver.run(expect_records: 2) do - d.run(default_tag: 'test') do - records.each do |record| - d.feed(time, record) + assert_rr do + target_input_driver.run(expect_records: 2) do + d.run(default_tag: 'test') do + records.each do |record| + d.feed(time, record) + end end end end @@ -491,10 +495,12 @@ def try_write(chunk) {"a" => 2} ] stub(d.instance.ack_handler).read_ack_from_sock(anything).never - target_input_driver.run(expect_records: 2) do - d.run(default_tag: 'test') do - records.each do |record| - d.feed(time, record) + assert_rr do + target_input_driver.run(expect_records: 2) do + d.run(default_tag: 'test') do + records.each do |record| + d.feed(time, record) + end end end end @@ -549,10 +555,12 @@ def try_write(chunk) ] # not attempt to receive responses stub(d.instance.ack_handler).read_ack_from_sock(anything).never - target_input_driver.run(expect_records: 2) do - d.run(default_tag: 'test') do - records.each do |record| - d.feed(time, record) + assert_rr do + target_input_driver.run(expect_records: 2) do + d.run(default_tag: 'test') do + records.each do |record| + d.feed(time, record) + end end end end @@ -575,10 +583,12 @@ def try_write(chunk) ] # not attempt to receive responses stub(d.instance.ack_handler).read_ack_from_sock(anything).never - target_input_driver.run(expect_records: 2) do - d.run(default_tag: 'test') do - records.each do |record| - d.feed(time, record) + assert_rr do + target_input_driver.run(expect_records: 2) do + d.run(default_tag: 'test') do + records.each do |record| + d.feed(time, record) + end end end end