Sha256: 6b2cf777cbfdf4217b8ef2dd2dac4320750077c8a9407f0a475e73c6f5876838

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

require "helper"
require "fluent/plugin/out_multi_condition_selector.rb"

class MultiConditionSelectorOutputText < Test::Unit::TestCase
  setup do
    Fluent::Test.setup
  end

  def create_driver(conf)
    Fluent::Test::Driver::Output.new(Fluent::Plugin::MultiConditionSelectorOutput).configure(conf)
  end

  test "simple_configure" do
    conf = config_element(
      'ROOT',
      '',
      {'tag' => "speak_chekc"},
      [
        config_element(
          'condition',
          '',
          {
            'rule' => 'record["action"] == "speak"',
            'condition' => 'speaking'
          },
          [
            config_element(
              'data',
              '',
              {
                'new_word' => 'record["word"] + "こんにちは"',
                'aaa' => 1
              },
              []
            )
          ]
        ),
        config_element(
          'condition',
          '',
          {
            'rule' => 'record["action"] != "speak"',
            'condition' => 'no_speak'
          },
          [
            config_element(
              'data',
              '',
              {
                'new_word' => 'record["word"] + "はじめまして"'
              },
              []
            )
          ]
        )
      ]
    )
    d = create_driver(conf)
    d.run(default_tag: 'test') do
      record = {
        'action' => "speak",
        "word" => "aaa"
      }
      d.feed(record)
      events = d.events
      pp events
    end
  end

  private

  def create_driver(conf)
    Fluent::Test::Driver::Output.new(Fluent::Plugin::MultiConditionSelectorOutput).configure(conf)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-plugin-multi-condition-selector-0.2.0 test/plugin/test_out_multi_condition_selector.rb
fluent-plugin-multi-condition-selector-0.1.0 test/plugin/test_out_multi_condition_selector.rb