Sha256: 581df2217967844876395389e3b38009e726e3ab20f468e7676f2459faf119c7

Contents?: true

Size: 1.26 KB

Versions: 24

Compression:

Stored size: 1.26 KB

Contents

require 'fluent/test'

class RoundRobinOutputTest < 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::RoundRobinOutput).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.emit({"a"=>3}, time)
    d.emit({"a"=>4}, time)

    os = d.instance.outputs

    assert_equal [
        [time, {"a"=>1}],
        [time, {"a"=>4}],
      ], os[0].events

    assert_equal [
        [time, {"a"=>2}],
      ], os[1].events

    assert_equal [
        [time, {"a"=>3}],
      ], os[2].events
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
fluentd-0.10.24 test/plugin/out_roundrobin.rb
fluentd-0.10.23 test/plugin/out_roundrobin.rb
fluentd-0.10.22 test/plugin/out_roundrobin.rb
fluentd-0.10.21 test/plugin/out_roundrobin.rb
fluentd-0.10.20 test/plugin/out_roundrobin.rb
fluentd-0.10.19 test/plugin/out_roundrobin.rb
fluentd-0.10.18 test/plugin/out_roundrobin.rb
fluentd-0.10.17 test/plugin/out_roundrobin.rb
fluentd-0.10.16 test/plugin/out_roundrobin.rb
fluentd-0.10.15 test/plugin/out_roundrobin.rb
fluentd-0.10.13 test/plugin/out_roundrobin.rb
fluentd-0.10.12 test/plugin/out_roundrobin.rb
fluentd-0.10.11 test/plugin/out_roundrobin.rb
fluentd-0.10.10 test/plugin/out_roundrobin.rb
fluentd-0.10.9 test/plugin/out_roundrobin.rb
fluentd-0.10.8 test/plugin/out_roundrobin.rb
fluentd-0.10.7 test/plugin/out_roundrobin.rb
fluentd-0.10.6 test/plugin/out_roundrobin.rb
fluentd-0.10.5 test/plugin/out_roundrobin.rb
fluentd-0.10.4 test/plugin/out_roundrobin.rb