Skip to content

Commit

Permalink
Merge branch 'master' of geofffranks/aws-fluent-plugin-kinesis and re…
Browse files Browse the repository at this point in the history
…solve conflict - awslabs#144
  • Loading branch information
simukappu committed Feb 17, 2019
1 parent 60115d1 commit 3cf6811
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion lib/fluent/plugin/kinesis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def data_formatter_create(conf)
if @data_key.nil?
->(tag, time, record) {
record = inject_values_to_record(tag, time, record)
compressor.call(formatter.format(tag, time, record).chomp.b)
# TODO Make option to chomp as compatible format with v2
# compressor.call(formatter.format(tag, time, record).chomp.b)
compressor.call(formatter.format(tag, time, record).b)
}
else
->(tag, time, record) {
Expand Down
10 changes: 5 additions & 5 deletions test/plugin/test_out_kinesis_firehose.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ def test_region
end

data(
'json' => ['json', "{\"a\":1,\"b\":2}\n"],
'ltsv' => ['ltsv', "a:1\tb:2\n"],
'json' => ['json', "{\"a\":1,\"b\":2}"],
'ltsv' => ['ltsv', "a:1\tb:2"],
)
def test_format(data)
formatter, expected = data
d = create_driver(default_config + "<format>\n@type #{formatter}\n</format>")
driver_run(d, [{"a"=>1,"b"=>2}])
assert_equal expected, @server.records.first
assert_equal ("#{expected}\n" + "\n").b, @server.records.first
end

data(
Expand All @@ -89,7 +89,7 @@ def test_format_without_append_new_line(data)
formatter, expected = data
d = create_driver(default_config + "<format>\n@type #{formatter}\n</format>\nappend_new_line false")
driver_run(d, [{"a"=>1,"b"=>2}])
assert_equal expected, @server.records.first
assert_equal "#{expected}\n".b, @server.records.first
end

def test_data_key
Expand Down Expand Up @@ -173,7 +173,7 @@ def test_multibyte_input
record = {"a" => "てすと"}
driver_run(d, [record])
assert_equal 0, d.instance.log.out.logs.size
assert_equal record.to_json.b + "\n", @server.records.first
assert_equal ("#{record.to_json}\n" + "\n").b, @server.records.first
end

def test_record_count
Expand Down
4 changes: 2 additions & 2 deletions test/plugin/test_out_kinesis_streams.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_format(data)
formatter, expected = data
d = create_driver(default_config + "<format>\n@type #{formatter}\n</format>")
driver_run(d, [{"a"=>1,"b"=>2}])
assert_equal expected, @server.records.first
assert_equal expected + "\n", @server.records.first
end

def test_partition_key_not_found
Expand Down Expand Up @@ -151,7 +151,7 @@ def test_multibyte_input
record = {"a" => "てすと"}
driver_run(d, [record])
assert_equal 0, d.instance.log.out.logs.size
assert_equal record.to_json.b, @server.records.first
assert_equal (record.to_json + "\n").b, @server.records.first
end

def test_record_count
Expand Down
4 changes: 2 additions & 2 deletions test/plugin/test_out_kinesis_streams_aggregated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_format(data)
formatter, expected = data
d = create_driver(default_config + "<format>\n@type #{formatter}\n</format>")
driver_run(d, [{"a"=>1,"b"=>2}])
assert_equal expected, @server.records.first
assert_equal (expected + "\n").b, @server.records.first
end

def test_data_key
Expand Down Expand Up @@ -172,7 +172,7 @@ def test_multibyte_input
record = {"a" => "てすと"}
driver_run(d, [record])
assert_equal 0, d.instance.log.out.logs.size
assert_equal record.to_json.b, @server.records.first
assert_equal (record.to_json + "\n").b, @server.records.first
end

data(
Expand Down

0 comments on commit 3cf6811

Please sign in to comment.