Sha256: 7f4719fb44a75ab372ebaa5f69ab246c503eebf708934fe1ed22e552645e432b
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
require 'helper' class MailOutputTest < Test::Unit::TestCase def setup Fluent::Test.setup end CONFIG_OUT_KEYS = %[ out_keys tag,time,value time_key time time_format %Y/%m/%d %H:%M:%S tag_key tag subject Fluentd Notification Alarm %s subject_out_keys tag host localhost port 25 from localhost@localdomain to localhost@localdomain ] CONFIG_CC_BCC = %[ out_keys tag,time,value time_key time time_format %Y/%m/%d %H:%M:%S tag_key tag subject Fluentd Notification Alarm %s subject_out_keys tag host localhost port 25 from localhost@localdomain cc localhost@localdomain bcc localhost@localdomain ] CONFIG_MESSAGE = %[ message out_mail: %s [%s]\\n%s message_out_keys tag,time,value time_key time time_format %Y/%m/%d %H:%M:%S tag_key tag subject Fluentd Notification Alarm %s subject_out_keys tag host localhost port 25 from localhost@localdomain to localhost@localdomain ] def create_driver(conf=CONFIG_OUT_KEYS,tag='test') Fluent::Test::OutputTestDriver.new(Fluent::MailOutput, tag).configure(conf) end def test_configure d = create_driver(CONFIG_OUT_KEYS) assert_equal 'localhost', d.instance.host d = create_driver(CONFIG_CC_BCC) assert_equal 'localhost', d.instance.host d = create_driver(CONFIG_MESSAGE) assert_equal 'localhost', d.instance.host end def test_out_keys d = create_driver(CONFIG_OUT_KEYS) time = Time.now.to_i d.run do d.emit({'value' => "out_keys mail from fluentd out_mail"}, time) end end def test_message d = create_driver(CONFIG_MESSAGE) time = Time.now.to_i d.run do d.emit({'value' => "message mail from fluentd out_mail"}, time) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-mail-0.1.0 | test/plugin/test_out_mail.rb |