Sha256: a2feb16dd7cbea602032f71c73d9c7c810117545367166cdcafd903f889c0258

Contents?: true

Size: 1.08 KB

Versions: 33

Compression:

Stored size: 1.08 KB

Contents

require 'fluent/test'

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

  CONFIG = %[
    <store>
      type test
      name c0
    </store>
    <store>
      type test
      name c1
    </store>
    <store>
      type test
      name c2
    </store>
  ]

  def create_driver(conf = CONFIG)
    Fluent::Test::OutputTestDriver.new(Fluent::CopyOutput).configure(conf)
  end

  def test_configure
    d = create_driver

    outputs = d.instance.outputs
    assert_equal 3, outputs.size
    assert_equal Fluent::TestOutput, outputs[0].class
    assert_equal Fluent::TestOutput, outputs[1].class
    assert_equal Fluent::TestOutput, outputs[2].class
    assert_equal "c0", outputs[0].name
    assert_equal "c1", outputs[1].name
    assert_equal "c2", outputs[2].name
  end

  def test_emit
    d = create_driver

    time = Time.parse("2011-01-02 13:14:15 UTC").to_i
    d.emit({"a"=>1}, time)
    d.emit({"a"=>2}, time)

    d.instance.outputs.each {|o|
      assert_equal [
          [time, {"a"=>1}],
          [time, {"a"=>2}],
        ], o.events
    }
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
fluentd-0.10.12 test/plugin/out_copy.rb
fluentd-0.10.11 test/plugin/out_copy.rb
fluentd-0.10.10 test/plugin/out_copy.rb
fluentd-0.10.9 test/plugin/out_copy.rb
fluentd-0.10.8 test/plugin/out_copy.rb
fluentd-0.10.7 test/plugin/out_copy.rb
fluentd-0.10.6 test/plugin/out_copy.rb
fluentd-0.10.5 test/plugin/out_copy.rb
fluentd-0.10.4 test/plugin/out_copy.rb
fluentd-0.10.3 test/plugin/out_copy.rb
fluentd-0.10.2 test/plugin/out_copy.rb
fluentd-0.10.1 test/plugin/out_copy.rb
fluentd-0.10.0 test/plugin/out_copy.rb