Sha256: 80c2774fd3561a75c8b78c284dd755705864f0c0b2ce35c58c985a80c8c6e49b
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
# encoding: utf-8 require "logstash/devutils/rspec/spec_helper" require "rspec/wait" require "rspec_sequencing" module FileInput FIXTURE_DIR = File.join('spec', 'fixtures') def self.make_file_older(path, seconds) time = Time.now.to_f - seconds ::File.utime(time, time, path) end def self.make_fixture_current(path, time = Time.now) ::File.utime(time, time, path) end def self.corrupt_gzip(file_path) f = File.open(file_path, "w") f.seek(12) f.puts 'corrupting_string' f.close() end class TracerBase def initialize @tracer = Concurrent::Array.new end def trace_for(symbol) params = @tracer.map {|k,v| k == symbol ? v : nil}.compact params.empty? ? false : params end def clear @tracer.clear end end class CodecTracer < TracerBase def decode_accept(ctx, data, listener) @tracer.push [:decode_accept, [ctx, data]] listener.process(ctx, {"message" => data}) end def accept(listener) @tracer.push [:accept, true] end def auto_flush(*) @tracer.push [:auto_flush, true] end def flush(*) @tracer.push [:flush, true] end def close @tracer.push [:close, true] end def clone self end end end require_relative "rspec_wait_handler_helper" unless defined? RSPEC_WAIT_HANDLER_PATCHED require_relative "logging_level_helper" unless defined? LOG_AT_HANDLED unless RSpec::Matchers.method_defined?(:receive_call_and_args) RSpec::Matchers.define(:receive_call_and_args) do |m, args| match do |actual| actual.trace_for(m) == args end failure_message do "Expecting method #{m} to receive: #{args} but got: #{actual.trace_for(m)}" end end end ENV["LOG_AT"].tap do |level| LogStash::Logging::Logger::configure_logging(level) unless level.nil? end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
logstash-input-file-4.4.2 | spec/helpers/spec_helper.rb |
logstash-input-file-4.4.1 | spec/helpers/spec_helper.rb |