Sha256: 8bf37fdb430f0f32950bf5335d79903088a5c2fb94181e33d3e75c57b2444502

Contents?: true

Size: 1.45 KB

Versions: 12

Compression:

Stored size: 1.45 KB

Contents

require 'helper'
require 'fluent/output'

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

  BASE_CONFIG = %[
    type kafka_buffered
  ]

  CONFIG = BASE_CONFIG + %[
    default_topic kitagawakeiko
    brokers localhost:9092
  ]

  def create_driver(conf = CONFIG, tag='test')
    Fluent::Test::BufferedOutputTestDriver.new(Fluent::KafkaOutputBuffered, tag).configure(conf)
  end

  def test_configure
    assert_nothing_raised(Fluent::ConfigError) {
      create_driver(BASE_CONFIG)
    }

    assert_nothing_raised(Fluent::ConfigError) {
      create_driver(CONFIG)
    }

    assert_nothing_raised(Fluent::ConfigError) {
      create_driver(CONFIG + %[
        buffer_type memory
      ])
    }

    d = create_driver
    assert_equal 'kitagawakeiko', d.instance.default_topic
    assert_equal 'localhost:9092', d.instance.brokers
  end

  def test_format
    d = create_driver
  end

  data("crc32" => "crc32",
      "murmur2" => "murmur2")
  def test_partitioner_hash_function(data)
    hash_type = data
    d = create_driver(CONFIG + %[partitioner_hash_function #{hash_type}])
    assert_nothing_raised do
      d.instance.refresh_client
    end
  end

  def test_mutli_worker_support
    d = create_driver
    assert_equal true, d.instance.multi_workers_ready?

  end

  def test_write
    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)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fluent-plugin-kafka-0.19.3 test/plugin/test_out_kafka_buffered.rb
fluent-plugin-kafka-0.19.2 test/plugin/test_out_kafka_buffered.rb
fluent-plugin-kafka-0.19.1 test/plugin/test_out_kafka_buffered.rb
fluent-plugin-kafka-0.19.0 test/plugin/test_out_kafka_buffered.rb
fluent-plugin-kafka-0.18.1 test/plugin/test_out_kafka_buffered.rb
fluent-plugin-kafka-0.18.0 test/plugin/test_out_kafka_buffered.rb
fluent-plugin-kafka-0.17.5 test/plugin/test_out_kafka_buffered.rb
fluent-plugin-kafka-0.17.4 test/plugin/test_out_kafka_buffered.rb
fluent-plugin-kafka-0.17.3 test/plugin/test_out_kafka_buffered.rb
fluent-plugin-kafka-0.17.2 test/plugin/test_out_kafka_buffered.rb
fluent-plugin-kafka-0.17.1 test/plugin/test_out_kafka_buffered.rb
fluent-plugin-kafka-0.17.0 test/plugin/test_out_kafka_buffered.rb