Sha256: 1c3021e38b7733ba01df5bd643fc8b5effb0ae3a3e3d56a920dab04166b32c51

Contents?: true

Size: 936 Bytes

Versions: 31

Compression:

Stored size: 936 Bytes

Contents

require 'fluent/test'
require 'net/http'

class ExecInputTest < Test::Unit::TestCase
  def setup
    Fluent::Test.setup
  end

  CONFIG = %[
    command bash -c "echo -e '2011-01-02 13:14:15\ttag1\tok'"
    keys time,tag,k1
    time_key time
    tag_key tag
    time_format %Y-%m-%d %H:%M:%S
    run_interval 1s
  ]

  def create_driver(conf=CONFIG)
    Fluent::Test::InputTestDriver.new(Fluent::ExecInput).configure(conf)
  end

  def test_configure
    d = create_driver
    assert_equal ["time","tag","k1"], d.instance.keys
    assert_equal "tag", d.instance.tag_key
    assert_equal "time", d.instance.time_key
    assert_equal "%Y-%m-%d %H:%M:%S", d.instance.time_format
  end

  def test_emit
    d = create_driver

    time = Time.parse("2011-01-02 13:14:15").to_i

    d.run do
      sleep 2
    end

    emits = d.emits
    assert_equal true, emits.length > 0
    assert_equal ["tag1", time, {"k1"=>"ok"}], emits[0]
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
fluentd-0.10.36 test/plugin/in_exec.rb
fluentd-0.10.35 test/plugin/in_exec.rb
fluentd-0.10.34 test/plugin/in_exec.rb
fluentd-0.10.33 test/plugin/in_exec.rb
fluentd-0.10.32 test/plugin/in_exec.rb
fluentd-0.10.31 test/plugin/in_exec.rb
fluentd-0.10.30 test/plugin/in_exec.rb
fluentd-0.10.29 test/plugin/in_exec.rb
fluentd-0.10.28 test/plugin/in_exec.rb
fluentd-0.10.27 test/plugin/in_exec.rb
fluentd-0.10.26 test/plugin/in_exec.rb
fluentd-0.10.25 test/plugin/in_exec.rb
fluentd-0.10.24 test/plugin/in_exec.rb
fluentd-0.10.23 test/plugin/in_exec.rb
fluentd-0.10.22 test/plugin/in_exec.rb
fluentd-0.10.21 test/plugin/in_exec.rb
fluentd-0.10.20 test/plugin/in_exec.rb
fluentd-0.10.19 test/plugin/in_exec.rb
fluentd-0.10.18 test/plugin/in_exec.rb
fluentd-0.10.17 test/plugin/in_exec.rb