Sha256: 365a55774e2db6c8a4816227e77a88532212b74a1a3d7deb8a9502769d35b62d

Contents?: true

Size: 1005 Bytes

Versions: 1

Compression:

Stored size: 1005 Bytes

Contents

require 'fluent/version'
major, minor, patch = Fluent::VERSION.split('.').map(&:to_i)
if major > 0 || (major == 0 && minor >= 14)
  require 'fluent/test/driver/output'
  require 'fluent/test/helpers'
  include Fluent::Test::Helpers

  class OutputTestDriver < Fluent::Test::Driver::Output
    def initialize(klass, tag)
      super(klass)
      @tag = tag
    end

    def configure(conf, use_v1)
      super(conf, syntax: use_v1 ? :v1 : :v0)
    end

    def run(&block)
      super(default_tag: @tag, &block)
    end

    def emit(record, time)
      feed(time, record)
    end

    def emits
      events
    end
  end

  def create_driver(conf, use_v1, default_tag: @tag)
    OutputTestDriver.new(Fluent::Plugin::RecordSplitterOutput, default_tag).configure(conf, use_v1)
  end
else
  def event_time(str)
    Time.parse(str)
  end

  def create_driver(conf, use_v1, default_tag: @tag)
    Fluent::Test::OutputTestDriver.new(Fluent::RecordSplitterOutput, default_tag).configure(conf, use_v1)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-plugin-record-splitter-0.0.1 test/output_test_driver.rb