test/plugin/test_out_add.rb in fluent-plugin-add-0.0.3 vs test/plugin/test_out_add.rb in fluent-plugin-add-0.0.4

- old
+ new

@@ -4,21 +4,36 @@ def setup Fluent::Test.setup end CONFIG = %[ + add_tag_prefix pre_hoge + <pair> + hoge moge + hogehoge mogemoge + </pair> ] - # CONFIG = %[ - # path #{TMP_DIR}/out_file_test - # compress gz - # utc - # ] - + def create_driver(conf = CONFIG, tag='test') - Fluent::Test::BufferedOutputTestDriver.new(Fluent::DataCounterOutput, tag).configure(conf) + Fluent::Test::OutputTestDriver.new(Fluent::AddOutput, tag).configure(conf) end - def test_configure + def test_configure + d = create_driver + assert_equal 'pre_hoge', d.instance.config["add_tag_prefix"] end -end + def test_format + d = create_driver + + time = Time.parse("2011-01-02 13:14:15 UTC").to_i + d.run do + d.emit("a" => 1) + end + mapped = {'hoge' => 'moge', 'hogehoge' => 'mogemoge'} + assert_equal [ + {"a" => 1}.merge(mapped), + ], d.records + d.run + end +end