Skip to content

Commit

Permalink
test_out_forward: Use assert_rr
Browse files Browse the repository at this point in the history
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 <class:ForwardOutputTest>'
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 <[email protected]>
  • Loading branch information
ashie committed Feb 18, 2022
1 parent d7fe2f5 commit b5a8fcc
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions test/plugin/test_out_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b5a8fcc

Please sign in to comment.