Sha256: ff3a09349ff7cc19b0471a48ae688b9892179897e812c333b6bf5ce8c80baa50

Contents?: true

Size: 876 Bytes

Versions: 9

Compression:

Stored size: 876 Bytes

Contents

require "stud/temporary"
module LogStashTest
  class Certicate
    attr_reader :ssl_key, :ssl_cert

    def initialize
      @ssl_cert = Stud::Temporary.pathname("ssl_certificate")
      @ssl_key = Stud::Temporary.pathname("ssl_key")

      system("openssl req -x509  -batch -nodes -newkey rsa:2048 -keyout #{ssl_key} -out #{ssl_cert} -subj /CN=localhost > /dev/null 2>&1")
    end
  end

  class << self
    def certificate
      Certicate.new
    end

    def random_port
      rand(2000..10000)
    end
  end
end

class DummyNeverBlockedQueue < Array
  def offer(element, timeout = nil)
    push(element)
  end

  alias_method :take, :shift
end

class DummyConnection
  def initialize(events)
    @events = events
  end

  def run
    @events.each do |element|
      yield element[:map], element[:identity_stream] 
    end
  end

  def peer
    "localhost:5555"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logstash-input-beats-2.2.7 spec/support/logstash_test.rb
logstash-input-beats-2.2.5 spec/support/logstash_test.rb
logstash-input-beats-2.2.3 spec/support/logstash_test.rb
logstash-input-beats-2.2.2 spec/support/logstash_test.rb
logstash-input-beats-2.2.0 spec/support/logstash_test.rb
logstash-input-beats-2.1.4 spec/support/logstash_test.rb
logstash-input-beats-2.1.3 spec/support/logstash_test.rb
logstash-input-beats-2.1.2 spec/support/logstash_test.rb
logstash-input-beats-2.1.1 spec/support/logstash_test.rb