Sha256: 76a16f464f7a9af6e372203587f783f5643a0c2bd7b1ee78d254db99acc991ae

Contents?: true

Size: 1.2 KB

Versions: 18

Compression:

Stored size: 1.2 KB

Contents

require 'fluent/load'
require 'fileutils'

src_root = File.expand_path('..', File.dirname(__FILE__))
$LOAD_PATH << File.join(src_root, "lib")
$LOAD_PATH << src_root

if ENV['SIMPLE_COV']
  require 'simplecov'
  if defined?(SimpleCov::SourceFile)
    mod = SimpleCov::SourceFile
    def mod.new(*args, &block)
      m = allocate
      m.instance_eval do
        begin
          initialize(*args, &block)
        rescue Encoding::UndefinedConversionError
          @src = "".force_encoding('UTF-8')
        end
      end
      m
    end
  end
  SimpleCov.start do
    add_filter 'spec/'
    add_filter 'pkg/'
    add_filter 'vendor/'
  end
end

if ENV['GC_STRESS']
  STDERR.puts "enable GC.stress"
  GC.stress = true
end

require 'fluent/log'
require 'fluent/plugin'

class DummyLogDevice
  attr_reader :logs
  def initialize ; @logs = [] ; end
  def tty? ; false ; end
  def puts(*args) ; args.each{ |arg| write(arg + "\n") } ; end
  def write(message) ; @logs.push message ; end
  def flush ; true ; end
  def close ; true ; end
end

class TestLogger < Fluent::PluginLogger
  def initialize
    @logdev = DummyLogDevice.new
    super(Fluent::Log.new(@logdev))
  end
  def logs
    @logdev.logs
  end
end

$log ||= TestLogger.new

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
fluentd-0.10.62 spec/spec_helper.rb
fluentd-0.10.61 spec/spec_helper.rb
fluentd-0.10.60 spec/spec_helper.rb
fluentd-0.10.59 spec/spec_helper.rb
fluentd-0.10.58 spec/spec_helper.rb
fluentd-0.10.57 spec/spec_helper.rb
fluentd-0.10.56 spec/spec_helper.rb
fluentd-0.10.55 spec/spec_helper.rb
fluentd-0.10.54 spec/spec_helper.rb
fluentd-0.12.0.pre.1 spec/spec_helper.rb
fluentd-0.10.53 spec/spec_helper.rb
fluentd-0.10.52 spec/spec_helper.rb
fluentd-0.10.51 spec/spec_helper.rb
fluentd-0.10.50 spec/spec_helper.rb
fluentd-0.10.49 spec/spec_helper.rb
fluentd-0.10.48 spec/spec_helper.rb
fluentd-0.10.47 spec/spec_helper.rb
fluentd-0.10.46 spec/spec_helper.rb