Module: Fluent::Test

Defined in:
lib/fluent/test.rb,
lib/fluent/test/log.rb,
lib/fluent/test/base.rb,
lib/fluent/test/helpers.rb,
lib/fluent/test/input_test.rb,
lib/fluent/test/driver/base.rb,
lib/fluent/test/filter_test.rb,
lib/fluent/test/output_test.rb,
lib/fluent/test/parser_test.rb,
lib/fluent/test/driver/input.rb,
lib/fluent/test/driver/filter.rb,
lib/fluent/test/driver/output.rb,
lib/fluent/test/driver/parser.rb,
lib/fluent/test/driver/storage.rb,
lib/fluent/test/formatter_test.rb,
lib/fluent/test/driver/formatter.rb,
lib/fluent/test/startup_shutdown.rb,
lib/fluent/test/driver/base_owned.rb,
lib/fluent/test/driver/base_owner.rb,
lib/fluent/test/driver/event_feeder.rb,
lib/fluent/test/driver/multi_output.rb,
lib/fluent/test/driver/test_event_router.rb

Defined Under Namespace

Modules: Driver, Helpers, StartupShutdown Classes: BufferedOutputTestDriver, DummyLogDevice, FilterTestDriver, FormatterTestDriver, InputTestDriver, OutputTestDriver, ParserTestDriver, TestDriver, TestLogger, TestOutputChain, TimeSlicedOutputTestDriver

Class Method Summary collapse

Class Method Details

.dummy_loggerObject



31
32
33
34
35
36
# File 'lib/fluent/test.rb', line 31

def self.dummy_logger
  dl_opts = {log_level: ServerEngine::DaemonLogger::INFO}
  logdev = Fluent::Test::DummyLogDevice.new
  logger = ServerEngine::DaemonLogger.new(logdev, dl_opts)
  Fluent::Log.new(logger)
end

.setupObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fluent/test.rb', line 38

def self.setup
  ENV['SERVERENGINE_WORKER_ID'] = '0'

  $log = dummy_logger

  Fluent.__send__(:remove_const, :Engine)
  engine = Fluent.const_set(:Engine, EngineClass.new).init(SystemConfig.new)

  engine.define_singleton_method(:now=) {|n|
    @now = n
  }
  engine.define_singleton_method(:now) {
    @now ||= super()
  }

  nil
end