Sha256: aa13d9e8398837fc57a3aada73c1d19c361954250387c713176b0e3c0e0e8c41

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 Bytes

Contents

require_relative 'helper'
require 'time'
require 'fluent/plugin/filter_where'

Fluent::Test.setup

class FilterWhereTest < Test::Unit::TestCase
  setup do
    @time = event_time("2010-05-04 03:02:01")
    Timecop.freeze(@time)
  end

  teardown do
    Timecop.return
  end

  sub_test_case '#configure' do
    test 'check default' do
      assert_raise(Fluent::ConfigError) { create_driver(%[]) }
    end

    test "where" do
      assert_nothing_raised { create_driver(%[where foo = 'foo']) }
    end
  end

  sub_test_case '#filter' do
    test "where" do
      d = create_driver(%[where foo = 'foo'])
      d.run do
        d.feed(@time, {'foo' => 'foo'})
        d.feed(@time, {'foo' => 'bar'})
      end
      assert { d.filtered_records == [{'foo' => 'foo'}] }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fluent-plugin-filter_where-1.0.3 test/test_filter_where.rb
fluent-plugin-filter_where-1.0.2 test/test_filter_where.rb
fluent-plugin-filter_where-1.0.1 test/test_filter_where.rb
fluent-plugin-filter_where-1.0.0 test/test_filter_where.rb