Sha256: 30f431f75445bb45d82ca687bf77ca48a010851f3edaf848e77c0e02e52204bf

Contents?: true

Size: 1.44 KB

Versions: 12

Compression:

Stored size: 1.44 KB

Contents

require 'fluent/test'
require 'fluent/plugin/out_tdlog'

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

  TMP_DIR = File.dirname(__FILE__) + "/tmp"

  CONFIG = %[
    apikey testkey
    buffer_path #{TMP_DIR}/buffer
  ]

  def create_driver(conf = CONFIG)
    Fluent::Test::BufferedOutputTestDriver.new(Fluent::TreasureDataLogOutput) do
      def start
        super
      end

      def write(chunk)
        chunk.read
      end
    end.configure(conf)
  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.run
  end

## TODO invalid names are normalized
#  def test_invalid_name
#    d = create_driver
#    d.instance.start
#
#    es = Fluent::OneEventStream.new(Time.now.to_i, {})
#    chain = Fluent::NullOutputChain.instance
#    assert_raise(RuntimeError) do
#      d.instance.emit("test.invalid-name", es, chain)
#    end
#    assert_raise(RuntimeError) do
#      d.instance.emit("empty", es, chain)
#    end
#    assert_raise(RuntimeError) do
#      d.instance.emit("", es, chain)
#    end
#  end

## TODO invalid data is ignored
#  def test_invalid_data
#    d = create_driver
#    d.instance.start
#
#    es = Fluent::OneEventStream.new(Time.now.to_i, "invalid")
#    chain = Fluent::NullOutputChain.instance
#    assert_nothing_raised do
#      d.instance.emit("test.name", es, chain)
#    end
#  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fluent-plugin-td-0.10.17 test/out_tdlog.rb
fluent-plugin-td-0.10.16 test/out_tdlog.rb
fluent-plugin-td-0.10.15 test/out_tdlog.rb
fluent-plugin-td-0.10.14 test/out_tdlog.rb
fluent-plugin-td-0.10.13 test/out_tdlog.rb
fluent-plugin-td-0.10.12 test/out_tdlog.rb
fluent-plugin-td-0.10.11 test/out_tdlog.rb
fluent-plugin-td-0.10.10 test/out_tdlog.rb
fluent-plugin-td-0.10.9 test/out_tdlog.rb
fluent-plugin-td-0.10.8 test/out_tdlog.rb
fluent-plugin-td-0.10.7 test/out_tdlog.rb
fluent-plugin-td-0.10.6 test/out_tdlog.rb