Skip to content

Commit

Permalink
Add testcode
Browse files Browse the repository at this point in the history
Signed-off-by: daipom <[email protected]>
  • Loading branch information
daipom committed Feb 15, 2022
1 parent 72eabbb commit 938c999
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/test_event_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,23 @@ def filter_with_time(tag, time, record); end
event_router.emit('test', Engine.now, 'k' => 'v')
end
end

test 'can pass records modified by filters to handle_emits_error' do
filter = Class.new(FluentTestFilter) { |x|
def filter_stream(_tag, es); end
}.new
event_router.add_rule('test', filter)
event_router.add_rule('test', error_output)

time = Engine.now
modified_es = OneEventStream.new(time, 'modified_label' => 'modified_value')

assert_rr do
stub(filter).filter_stream { modified_es }
mock(emit_handler).handle_emits_error('test', modified_es, is_a(RuntimeError))
event_router.emit('test', time, 'pre_label' => 'pre_value')
end
end
end
end
end

0 comments on commit 938c999

Please sign in to comment.