Sha256: 18a22861af2eb3ddd5c81ad7f5179c799756d15a290945f3be69d839993ae65a
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
require_relative '../helper' require "test/unit/rr" class FlowCounterSimpleFilterTest < Test::Unit::TestCase include Fluent def setup Fluent::Test.setup @time = Fluent::Engine.now end CONFIG = %[ unit second ] def create_driver(conf = CONFIG) Fluent::Test::FilterTestDriver.new(Fluent::FlowCounterSimpleFilter).configure(conf, true) end def test_filter msgs = [] 10.times do msgs << {'message'=> 'a' * 100} msgs << {'message'=> 'b' * 100} end d = create_driver filtered, out = filter(d, msgs) assert_equal msgs, filtered assert( out.include?("count:20"), out ) end private def filter(d, msgs) stub(d.instance.output).start stub(d.instance.output).shutdown d.run { msgs.each {|msg| d.filter(msg, @time) } } out = capture_log(d.instance.output.log) do d.instance.flush_emit(0) end filtered = d.filtered_as_array filtered_msgs = filtered.map {|m| m[2] } [filtered_msgs, out] end end if defined?(Fluent::Filter)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-flowcounter-simple-0.0.4 | test/plugin/test_filter_flowcounter_simple.rb |