Sha256: e5f8e3080604f59e36b0cb17999f1dc5dd8f94abd45cc1f213d57d35925dbfe7

Contents?: true

Size: 1.13 KB

Versions: 47

Compression:

Stored size: 1.13 KB

Contents

require_relative 'helper'
require 'fluent/test'
require 'fluent/event'
require 'fluent/process'
require 'stringio'
require 'msgpack'

module FluentProcessTest
  class DelayedForwarderTest < Test::Unit::TestCase
    include Fluent

    test 'run and emit' do
      io = StringIO.new
      fwd = Fluent::DetachProcessManager::DelayedForwarder.new(io, 0.001)

      num_events_per_tag = 5000
      num_tags = 20

      now = Time.now.to_i
      record = {'key' => 'value'}
      (num_tags * num_events_per_tag).times do |i|
        tag = "foo.bar#{i % num_tags}"
        fwd.emit(tag, OneEventStream.new(now, record))
      end
      sleep 0.5

      io.pos = 0

      tags = {}
      MessagePack::Unpacker.new(io).each do |tag_and_msgpacks|
        tag, ms = *tag_and_msgpacks
        tags[tag] ||= ''
        tags[tag] << ms
      end

      assert_equal(num_tags, tags.size)
      num_tags.times do |i|
        tag = "foo.bar#{i % num_tags}"
        ms = tags[tag]
        count = 0
        MessagePack::Unpacker.new(StringIO.new(ms)).each do |x|
          count += 1
        end
        assert_equal(num_events_per_tag, count)
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
fluentd-0.12.43 test/test_process.rb
fluentd-0.12.42 test/test_process.rb
fluentd-0.12.41 test/test_process.rb
fluentd-0.12.40 test/test_process.rb
fluentd-0.12.39 test/test_process.rb
fluentd-0.12.38 test/test_process.rb
fluentd-0.12.37 test/test_process.rb
fluentd-0.12.36 test/test_process.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/fluentd-0.12.35/test/test_process.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/fluentd-0.12.35/test/test_process.rb
fluentd-0.12.35 test/test_process.rb
fluentd-0.12.34 test/test_process.rb
fluentd-0.12.33 test/test_process.rb
fluentd-0.12.32 test/test_process.rb
fluentd-0.14.11-x64-mingw32 test/test_process.rb
fluentd-0.14.11-x86-mingw32 test/test_process.rb
fluentd-0.14.11 test/test_process.rb
fluentd-0.12.31 test/test_process.rb
fluentd-0.14.10-x64-mingw32 test/test_process.rb
fluentd-0.14.10-x86-mingw32 test/test_process.rb