test/plugin/test_out_flume.rb in fluent-plugin-flume-0.1.2 vs test/plugin/test_out_flume.rb in fluent-plugin-flume-0.1.3
- old
+ new
@@ -11,11 +11,11 @@
host 127.0.0.1
port 35862
]
def create_driver(conf=CONFIG, tag='test')
- Fluent::Test::BufferedOutputTestDriver.new(Fluent::FlumeOutput, tag)do
+ Fluent::Test::BufferedOutputTestDriver.new(Fluent::FlumeOutput, tag) do
def write(chunk)
chunk.read
end
end.configure(conf)
end
@@ -39,48 +39,49 @@
time = Time.parse("2011-12-21 13:14:15 UTC").to_i
d = create_driver
d.emit({"k11"=>"v11", "k12"=>"v12"}, time)
d.emit({"k21"=>"v21", "k22"=>"v22"}, time)
- d.expect_format [d.tag, time, {"k11"=>"v11", "k12"=>"v12"}].to_msgpack
- d.expect_format [d.tag, time, {"k21"=>"v21", "k22"=>"v22"}].to_msgpack
+ puts ({"k11" => "v11", "k12" => "v12"}.to_json)
+ d.expect_format [d.tag, time, {"k11"=>"v11", "k12"=>"v12"}.to_json].to_msgpack
+ d.expect_format [d.tag, time, {"k21"=>"v21", "k22"=>"v22"}.to_json].to_msgpack
d.run
d = create_driver(CONFIG + %[
remove_prefix test
], 'test.flumeplugin')
assert_equal 'test.flumeplugin', d.tag
d.emit({"k11"=>"v11", "k12"=>"v12"}, time)
d.emit({"k21"=>"v21", "k22"=>"v22"}, time)
- d.expect_format ['flumeplugin', time, {"k11"=>"v11", "k12"=>"v12"}].to_msgpack
- d.expect_format ['flumeplugin', time, {"k21"=>"v21", "k22"=>"v22"}].to_msgpack
+ d.expect_format ['flumeplugin', time, {"k11"=>"v11", "k12"=>"v12"}.to_json].to_msgpack
+ d.expect_format ['flumeplugin', time, {"k21"=>"v21", "k22"=>"v22"}.to_json].to_msgpack
d.run
d = create_driver(CONFIG + %[
remove_prefix test
], 'xxx.test.flumeplugin')
assert_equal 'xxx.test.flumeplugin', d.tag
d.emit({"k11"=>"v11", "k12"=>"v12"}, time)
- d.expect_format ['xxx.test.flumeplugin', time, {"k11"=>"v11", "k12"=>"v12"}].to_msgpack
+ d.expect_format ['xxx.test.flumeplugin', time, {"k11"=>"v11", "k12"=>"v12"}.to_json].to_msgpack
d.run
d = create_driver(CONFIG + %[
remove_prefix test
], 'test')
assert_equal 'test', d.tag
d.emit({"k11"=>"v11", "k12"=>"v12"}, time)
- d.expect_format ['unknown', time, {"k11"=>"v11", "k12"=>"v12"}].to_msgpack
+ d.expect_format ['unknown', time, {"k11"=>"v11", "k12"=>"v12"}.to_json].to_msgpack
d.run
d = create_driver(CONFIG + %[
remove_prefix test
], 'test.flumeplugin')
assert_equal 'test.flumeplugin', d.tag
d.emit({"k11"=>"v11", "k12"=>"v12"}, time)
d.emit({"k21"=>"v21", "k22"=>"v22"}, time)
- d.expect_format ['flumeplugin', time, {"k11"=>"v11", "k12"=>"v12"}].to_msgpack
- d.expect_format ['flumeplugin', time, {"k21"=>"v21", "k22"=>"v22"}].to_msgpack
+ d.expect_format ['flumeplugin', time, {"k11"=>"v11", "k12"=>"v12"}.to_json].to_msgpack
+ d.expect_format ['flumeplugin', time, {"k21"=>"v21", "k22"=>"v22"}.to_json].to_msgpack
d.run
end
def test_write
time = Time.parse("2011-12-21 13:14:15 UTC").to_i