Sha256: 565341c81fd770ef8694fdfa3fb4fa3211d74cdac25a74228cff25d16ba70118

Contents?: true

Size: 1.32 KB

Versions: 13

Compression:

Stored size: 1.32 KB

Contents

require 'fluent/test'
require 'helper'

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

  CONFIG = %[
    send_timeout 51
    <server>
      name test
      host 127.0.0.1
      port 13999
    </server>
  ]

  def create_driver(conf=CONFIG)
    Fluent::Test::OutputTestDriver.new(Fluent::ForwardOutput) do
      def write(chunk)
        chunk.read
      end
    end.configure(conf)
  end

  def test_configure
    d = create_driver
    nodes = d.instance.nodes
    assert_equal 51, d.instance.send_timeout
    assert_equal :udp, d.instance.heartbeat_type
    assert_equal 1, nodes.length
    node = nodes.first
    assert_equal "test", node.name
    assert_equal '127.0.0.1', node.host
    assert_equal 13999, node.port
  end

  def test_configure_tcp_heartbeat
    d = create_driver(CONFIG + "\nheartbeat_type tcp")
    assert_equal :tcp, d.instance.heartbeat_type
  end

  def test_phi_failure_detector
    d = create_driver(CONFIG + %[phi_failure_detector false \n phi_threshold 0])
    node = d.instance.nodes.first
    stub(node.failure).phi { raise 'Should not be called' }
    node.tick
    assert_equal node.available, true

    d = create_driver(CONFIG + %[phi_failure_detector true \n phi_threshold 0])
    node = d.instance.nodes.first
    node.tick
    assert_equal node.available, false
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fluentd-0.10.57 test/plugin/test_out_forward.rb
fluentd-0.10.56 test/plugin/test_out_forward.rb
fluentd-0.10.55 test/plugin/test_out_forward.rb
fluentd-0.10.54 test/plugin/test_out_forward.rb
fluentd-0.12.0.pre.1 test/plugin/test_out_forward.rb
fluentd-0.10.53 test/plugin/test_out_forward.rb
fluentd-0.10.52 test/plugin/test_out_forward.rb
fluentd-0.10.51 test/plugin/test_out_forward.rb
fluentd-0.10.50 test/plugin/test_out_forward.rb
fluentd-0.10.49 test/plugin/test_out_forward.rb
fluentd-0.10.48 test/plugin/test_out_forward.rb
fluentd-0.10.47 test/plugin/test_out_forward.rb
fluentd-0.10.46 test/plugin/test_out_forward.rb