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.33 test/plugin/out_copy.rb
fluentd-0.10.32 test/plugin/out_copy.rb
fluentd-0.10.31 test/plugin/out_copy.rb
fluentd-0.10.30 test/plugin/out_copy.rb
fluentd-0.10.29 test/plugin/out_copy.rb
fluentd-0.10.28 test/plugin/out_copy.rb
fluentd-0.10.27 test/plugin/out_copy.rb
fluentd-0.10.26 test/plugin/out_copy.rb
fluentd-0.10.25 test/plugin/out_copy.rb
fluentd-0.10.24 test/plugin/out_copy.rb
fluentd-0.10.23 test/plugin/out_copy.rb
fluentd-0.10.22 test/plugin/out_copy.rb
fluentd-0.10.21 test/plugin/out_copy.rb
fluentd-0.10.20 test/plugin/out_copy.rb
fluentd-0.10.19 test/plugin/out_copy.rb
fluentd-0.10.18 test/plugin/out_copy.rb
fluentd-0.10.17 test/plugin/out_copy.rb
fluentd-0.10.16 test/plugin/out_copy.rb
fluentd-0.10.15 test/plugin/out_copy.rb
fluentd-0.10.13 test/plugin/out_copy.rb