Sha256: b5b5077bf61da1ea30a76885aef6083c5b5f4d6749f7d0e88481f3a4a33acb75

Contents?: true

Size: 810 Bytes

Versions: 1

Compression:

Stored size: 810 Bytes

Contents

require 'helper'
class ExecPlaceholderOutputTest < Test::Unit::TestCase
  def setup
    Fluent::Test.setup
  end

  def create_driver(conf = CONFIG, tag='test')
    Fluent::Test::OutputTestDriver.new(Fluent::ExecPlaceholderOutput, tag).configure(conf)
  end

  def test_configure
    d = create_driver(%[
      command /etc/init.d/httpd restart
    ])
    assert_equal "/etc/init.d/httpd restart", d.instance.command
  end

  def test_emit
    d1 = create_driver(%[
      command echo ${tag}
      ],
      'input.access'
    )
    d1.run do
      d1.emit({'domain' => 'www.google.com', 'path' => '/foo/bar?key=value', 'agent' => 'Googlebot', 'response_time' => 1000000})
      d1.emit({'domain' => 'news.google.com', 'path' => '/', 'agent' => 'Googlebot-Mobile', 'response_time' => 900000})
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-plugin-exec_placeholder-0.0.2 test/plugin/test_out_exec_placeholder.rb