Skip to content

Commit

Permalink
Added UTs
Browse files Browse the repository at this point in the history
Signed-off-by: Athish Pranav D <[email protected]>
  • Loading branch information
Athishpranav2003 committed Sep 10, 2024
1 parent 90c8501 commit 9ec5a95
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/plugin/test_filter_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,24 @@ def test_filter

data(:keep_key_name => false,
:remove_key_name => true)

def test_filter_with_multiple_records
d1 = create_driver(%[
key_name data
<parse>
@type json
</parse>
])
time = Fluent::EventTime.from_time(@default_time)
d1.run(default_tag: @tag) do
d1.feed(time, {'data' => '[{"xxx_1":"first","yyy":"second"}, {"xxx_2":"first", "yyy_2":"second"}]'})
end
filtered = d1.filtered
assert_equal 2, filtered.length
assert_equal ({"xxx_1"=>"first", "yyy"=>"second"}), filtered[0][1]
assert_equal ({"xxx_2"=>"first", "yyy_2"=>"second"}), filtered[1][1]

end
def test_filter_with_reserved_data(remove_key_name)
d1 = create_driver(%[
key_name data
Expand Down

0 comments on commit 9ec5a95

Please sign in to comment.