Sha256: 977562e3754f95b019101eec033a402d3099f5c11fb960bf70c7907ebc6ea40f
Contents?: true
Size: 1021 Bytes
Versions: 1
Compression:
Stored size: 1021 Bytes
Contents
require 'fluent/test' require 'fluent/plugin/out_record_modifier' class RecordModifierOutputTest < Test::Unit::TestCase def setup Fluent::Test.setup end CONFIG = %[ type record_modifier tag foo.filtered gen_host ${hostname} foo bar include_tag_key tag_key included_tag ] def create_driver(conf = CONFIG) Fluent::Test::OutputTestDriver.new(Fluent::RecordModifierOutput, tag='test_tag').configure(conf) end def get_hostname require 'socket' Socket.gethostname.chomp end def test_configure d = create_driver map = d.instance.instance_variable_get(:@map) assert_equal get_hostname, map['gen_host'] assert_equal 'bar', map['foo'] end def test_format d = create_driver d.run do d.emit("a" => 1) d.emit("a" => 2) end mapped = {'gen_host' => get_hostname, 'foo' => 'bar', 'included_tag' => 'test_tag'} assert_equal [ {"a" => 1}.merge(mapped), {"a" => 2}.merge(mapped), ], d.records end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-record-modifier-0.1.1 | test/out_record_modifier.rb |