test/plugin/test_out_map.rb in fluent-plugin-map-0.0.3 vs test/plugin/test_out_map.rb in fluent-plugin-map-0.0.3.1
- old
+ new
@@ -78,10 +78,29 @@
chain = Fluent::Test::TestOutputChain.new
e = d1.instance.emit(tag, es, chain)
assert e.kind_of?(SyntaxError)
end
+ def test_tag_convert_using_tag_time_record
+ tag = 'tag'
+ time = Time.local(2012, 10, 10, 10, 10, 10)
+ record = {'code' => '300'}
+
+ d1 = create_driver %[
+ tag "newtag"
+ time time
+ record record
+ ], tag
+ d1.run do
+ d1.emit(record, time)
+ end
+ emits = d1.emits
+ assert_equal 1, emits.length
+ assert_equal ["newtag", time.to_i, record], emits[0]
+ end
+
+ #deprected specification test
def test_tag_convert_using_key_time_record
tag = 'tag'
time = Time.local(2012, 10, 10, 10, 10, 10)
record = {'code' => '300'}
@@ -96,11 +115,11 @@
emits = d1.emits
assert_equal 1, emits.length
assert_equal ["newtag", time.to_i, record], emits[0]
end
- def test_config_error_key
+ def test_config_error_tag
tag = "tag"
time = Time.local(2012, 10, 10, 10, 10, 0)
record = {'code' => '300'}
#require time
@@ -117,11 +136,11 @@
record = {'code' => '300'}
#require time
assert_raise(Fluent::ConfigError){
create_driver %[
- key "newtag"
+ tag "newtag"
record record
], tag
}
end
@@ -130,11 +149,11 @@
time = Time.local(2012, 10, 10, 10, 10, 0)
#require record
assert_raise(Fluent::ConfigError){
create_driver %[
- key "newtag"
+ tag "newtag"
time time
], tag
}
end
@@ -145,10 +164,10 @@
record = {'code' => '300'}
#require time
assert_raise(Fluent::ConfigError){
create_driver %[
- key "newtag"
+ tag "newtag"
time time
record record
multi true
], tag
}