Sha256: b5e0a0e08eace390e3e9eb3f70f1376b39e734b922c6a0569ed7ad40932342cd

Contents?: true

Size: 470 Bytes

Versions: 14

Compression:

Stored size: 470 Bytes

Contents

# encoding: utf-8
require "logstash/devutils/rspec/spec_helper"

# this has been taken from the udp input, it should be DRYed

class TcpHelpers

  def pipelineless_input(plugin, size, &block)
    queue = Queue.new
    input_thread = Thread.new do
      plugin.run(queue)
    end
    block.call
    sleep 0.1 while queue.size != size
    result = size.times.inject([]) do |acc|
      acc << queue.pop
    end
    plugin.do_stop
    input_thread.join
    result
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
logstash-input-graphite-3.0.6 spec/spec_helper.rb
logstash-input-graphite-3.0.4 spec/spec_helper.rb
logstash-input-graphite-3.0.3 spec/spec_helper.rb
logstash-input-graphite-3.0.2 spec/spec_helper.rb
logstash-input-graphite-3.0.1 spec/spec_helper.rb
logstash-input-graphite-3.0.0 spec/spec_helper.rb
logstash-input-graphite-2.0.7 spec/spec_helper.rb
logstash-input-graphite-2.0.5 spec/spec_helper.rb
logstash-input-tcp-2.0.5 spec/spec_helper.rb
logstash-input-tcp-2.0.4 spec/spec_helper.rb
logstash-input-graphite-2.0.4 spec/spec_helper.rb
logstash-input-graphite-2.0.3 spec/spec_helper.rb
logstash-input-tcp-2.0.3 spec/spec_helper.rb
logstash-input-graphite-2.0.2 spec/spec_helper.rb