Sha256: 52325e07f4a1a7bbbfd3f3f34643d7e21ef00f850cd179d3bcb9df834054ad6f

Contents?: true

Size: 807 Bytes

Versions: 16

Compression:

Stored size: 807 Bytes

Contents

require 'fluent/test'

class ObjectSpaceInputTest < Test::Unit::TestCase
  class FailObject
    def self.class
      raise "error"
    end
  end

  def setup
    Fluent::Test.setup
  end

  TESTCONFIG = %[
    emit_interval 1
    tag t1
    top 2
  ]

  def create_driver(conf=TESTCONFIG)
    Fluent::Test::InputTestDriver.new(Fluent::ObjectSpaceInput).configure(conf)
  end

  def test_configure
    d = create_driver
    assert_equal 1, d.instance.emit_interval
    assert_equal "t1", d.instance.tag
    assert_equal 2, d.instance.top
  end

  def test_emit
    d = create_driver

    time = Time.parse("2011-01-02 13:14:15").to_i

    d.run do
      sleep 2
    end

    emits = d.emits
    assert_equal true, emits.length > 0

    tag, time, record = emits[0]
    assert_equal 2, record.size
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fluentd-0.10.52 test/plugin/test_in_object_space.rb
fluentd-0.10.51 test/plugin/test_in_object_space.rb
fluentd-0.10.50 test/plugin/test_in_object_space.rb
fluentd-0.10.49 test/plugin/test_in_object_space.rb
fluentd-0.10.48 test/plugin/test_in_object_space.rb
fluentd-0.10.47 test/plugin/test_in_object_space.rb
fluentd-0.10.46 test/plugin/test_in_object_space.rb
fluentd-0.10.45 test/plugin/in_object_space.rb
fluentd-0.10.44 test/plugin/in_object_space.rb
fluentd-0.10.43 test/plugin/in_object_space.rb
fluentd-0.10.42 test/plugin/in_object_space.rb
fluentd-0.10.41 test/plugin/in_object_space.rb
fluentd-0.10.40 test/plugin/in_object_space.rb
fluentd-0.10.39 test/plugin/in_object_space.rb
fluentd-0.10.38 test/plugin/in_object_space.rb
fluentd-0.10.37 test/plugin/in_object_space.rb