Sha256: 5ec7d5f00b7f36c05383bfc1c4ecaa93d573193a131bf0ccf838ce3d1edf118a

Contents?: true

Size: 1.43 KB

Versions: 18

Compression:

Stored size: 1.43 KB

Contents

require "test_helper"
require "fluent/plugin/out_remote_syslog"

class RemoteSyslogOutputTest < MiniTest::Unit::TestCase
  def setup
    Fluent::Test.setup
  end

  def create_driver(conf = CONFIG, tag = "test.remote_syslog")
    Fluent::Test::OutputTestDriver.new(Fluent::RemoteSyslogOutput, tag) {}.configure(conf)
  end

  def test_configure
    d = create_driver %[
      type remote_syslog
      hostname foo.com
      host example.com
      port 5566
      severity debug
      tag minitest
    ]

    d.run do
      d.emit(message: "foo")
    end

    loggers = d.instance.instance_variable_get(:@loggers)
    refute_empty loggers

    logger = loggers.values.first

    assert_equal "example.com", logger.instance_variable_get(:@remote_hostname)
    assert_equal 5566, logger.instance_variable_get(:@remote_port)

    p = logger.instance_variable_get(:@packet)
    assert_equal "foo.com", p.hostname
    assert_equal 1, p.facility
    assert_equal "minitest", p.tag
    assert_equal 7, p.severity
  end

  def test_rewrite_tag
    d = create_driver %[
      type remote_syslog
      hostname foo.com
      host example.com
      port 5566
      severity debug
      tag rewrited.${tag_parts[1]}
    ]

    d.run do
      d.emit(message: "foo")
    end

    loggers = d.instance.instance_variable_get(:@loggers)
    logger = loggers.values.first

    p = logger.instance_variable_get(:@packet)
    assert_equal "rewrited.remote_syslog", p.tag
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
fluent-plugin-remote_syslog_tcp-0.3.9.95 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.9.9 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.9.7 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.9.6 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.9.5 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.9.4 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.9.3 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.9.2 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.9.1 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.9 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.8 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.7 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.6 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.5 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.4 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog_tcp-0.3.3 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog-0.3.3 test/plugin/out_remote_syslog.rb
fluent-plugin-remote_syslog-0.3.2 test/plugin/out_remote_syslog.rb