RSpec
, minitest
, etc.input
, output
, filter
, parser
and formatter
.#instance
method. If utility methods are private
, use __send__
.initialize(klass, opts: {}, &block)
klass
: A class of Fluentd pluginopts
: Overwrite system config. This parameter is useful for testing multiblock
: Customize plugin behavior. We can overwrite plugin code in thisconfigure(conf, syntax: :v1)
conf
: Fluent::Config::Element
or String
syntax
: { :v1
, :v0
, :ruby
} :v0
is obsolete.end_if(&block)
true
before Test Driver stops.break_if(&block)
true
.broken?
true
when some of the breaking conditions are true
. Otherwise false
.run(timeout: nil, start: true, shutdown: true, &block)
block
if given.timeout
: timeout (seconds)start
: if true
, start the Test Driver. Otherwise, invoke instance_start
shutdown
: if true
, shut down the running Test Driver.stop?
true
when all the stopping conditions are true
. Otherwise false
.logs
instance
filter
output
multi_output
run(expect_emits: nil, expect_records: nil, timeout: nil, start: true, shutdown: true, &block)
block
if given.expect_emits
: set the number of expected emitsexpect_records
: set the number of expected recordstimeout
: timeout (seconds)start
: if true
, start the Test Driver. Otherwise, invoke theinstance_start
method to start it.shutdown
: if true
, shut down the running Test Driver.events(tag: nil)
tag
: filter by this tag. If omitted, it returns all the events.event_streams(tag: nil)
tag
: filter by this tag. If omitted, it returns all the event streams.emit_count
router.emit
.d.run(expected_records: n)
instead.record_count
d.run(expected_records: n)
instead.error_events(tag: nil)
tag
: filter by this tag. If omitted, it returns all error events.configure(conf, syntax: :v1)
conf
: Fluent::Config::Element
, String
, or Hash
syntax
: Supported: { :v1
, :v0
, :ruby
} :v0
is obsolete.filter
output
multi_output
run(default_tag: nil, **kwargs, &block)
EventFeeder
.default_tag
: the default tag of the eventfeed(tag, time, record)
tag
: the tag of the eventtime
: event timestamprecord
: event recordfeed(tag, array_event_stream)
tag
: the tag of the eventarray_event_stream
: array of [time, record]
time
: event timestamprecord
: event recordfeed(tag, es)
tag
: the tag of the eventes
: event stream objectfeed(record)
record
: event recordfeed(time, record)
time
: event timestamprecord
: event recordfeed(array_event_stream)
array_event_stream
: array of [time, record]
time
: event timestamprecord
: event recordfeed(es)
es
: event stream objectfiltered_records
run(flush: true, wait_flush_completion: true, force_flush_retry: false, **kwargs, &block)
flush
: flush forciblywait_flush_completion
: if true
, waiting for flush
to completeforce_flush_retry
: if true
, retrying flush forciblyblock
if given.formatted
flush
assert_equal_event_time(expected, actual, message = nil)
EventTime
instance.expected
: expected EventTime
instanceactual
: actual EventTime
instancemessage
: message to display when assertion failsconfig_element(name = 'test', argument = '', params = {}, elements = [])
Fluent::Config::Element
instance.name
: element name such as match
, filter
, source
, buffer
, inject
,format
, parse
, etc.argument
: argument for section defined by config_argument
params
: parameters for section defined by config_element
elements
: child elements of this config elementevent_time(str = nil, format: nil)
Fluent::EventTime
instance.str
: time represented as String
format
: parse str
as time
according to this format. See alsowith_timezone(tz, &block)
tz
. This method overrides ENV['TZ']
while processing its block
.tz
: timezone. This is set to ENV['TZ']
.with_worker_config(root_dir: nil, workers: nil, worker_id: nil, &block)
block
with the given parameters. This method overrides the system configuration while processing its block
.root_dir
: root directoryworkers
: the number of workersworker_id
: ID of workerstime2str(time, localtime: false, format: nil)
time
to String
.time
: Fluent::EventTime
instance. See alsolocaltime
: If true
, processes time
as localtime
. Otherwise UTC.format
: See alsomsgpack(type)
type
: Available types: { :factory
, :packer
, :unpacker
}Fluent::MessagePackFactory.factory
Fluent::MessagePackFactory.packer
Fluent::MessagePackFactory.unpacker
capture_stdout(&block)
router#emit
method. But you do not have to test this method explicitly. Its testing code pattern is encapsulated in the Input Test Driver.#filter
method. But you do not have to test this method explicitly. Its testing code pattern is encapsulated in Filter Test Driver.#process
or #write
or #try_write
method. But you do not have to test this method explicitly. Its testing code pattern is encapsulated in the Output Test Driver.#parse
method.#format
method.