Skip to content

Commit a5de3f4

Browse files
committed
[MK]refactoring and cleanup of oversights
1 parent 9761c89 commit a5de3f4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/fluent/plugin/filter_concat.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def flush_buffer(stream_identity, new_element = nil)
388388
end
389389

390390
def flush_timeout_buffer
391-
now =time_event_now
391+
now = time_event_now
392392
timeout_stream_identities = []
393393
@timeout_map_mutex.synchronize do
394394
@timeout_map.each do |stream_identity, previous_timestamp|

test/plugin/test_filter_concat.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
require "bundler/setup"
2-
require "test-unit"
3-
require "test/unit/rr"
4-
require "fluent/test"
5-
require "fluent/plugin/filter_concat"
6-
1+
require "helper"
72
require "fluent/test/driver/filter"
83
class FilterConcatTest < Test::Unit::TestCase
94
def setup
@@ -39,7 +34,10 @@ def filter_with_time(conf, messages, wait: nil)
3934
d.run(default_tag: "test") do
4035
sleep 0.1 # run event loop
4136
messages.each do |time, message|
42-
sleep time-time_event_now
37+
now = time_event_now
38+
if now < time
39+
sleep time-now
40+
end
4341
d.feed(time, message)
4442
end
4543
sleep wait if wait
@@ -260,7 +258,7 @@ def time_event_now
260258
flush_interval 1s
261259
timeout_label @TIMEOUT
262260
CONFIG
263-
wait = 8
261+
wait = 3
264262
delay_message_4_to_5 = 3
265263
delay_message_5_to_6 = 1
266264

@@ -278,6 +276,8 @@ def time_event_now
278276
event_router = mock(Object.new).emit("test", anything, errored)
279277
mock(Fluent::Test::Driver::TestEventRouter).new(anything) { event_router }
280278
stub.proxy(d.instance).flush_timeout_buffer.times(wait + delay_message_4_to_5 + delay_message_5_to_6)
279+
stub.proxy(d.instance).handle_timeout_error.times(1)
280+
281281
end
282282
expected = [
283283
[@time, { "container_id" => "1", "message" => "start\n message 1\n message 2" }],

0 commit comments

Comments
 (0)