Sha256: 9c8e2c2f28269ac54a9c5ad35300482f6deef31ed4a840c98aceadc7188c17af

Contents?: true

Size: 1.55 KB

Versions: 234

Compression:

Stored size: 1.55 KB

Contents

require_relative '../helper'
require 'fluent/plugin/input'
require 'fluent/test/driver/input'

module ConfigurationForPlugins
  class AllBooleanParams < Fluent::Plugin::Input
    config_param :flag1, :bool, default: true
    config_param :flag2, :bool, default: true
    config_param :flag3, :bool, default: false
    config_param :flag4, :bool, default: false

    config_section :child, param_name: :children, multi: true, required: true do
      config_param :flag1, :bool, default: true
      config_param :flag2, :bool, default: true
      config_param :flag3, :bool, default: false
      config_param :flag4, :bool, default: false
    end
  end

  class BooleanParamsWithoutValue < ::Test::Unit::TestCase
    CONFIG = <<CONFIG
    flag1 
    flag2 # yaaaaaaaaaay
    flag3 
    flag4 # yaaaaaaaaaay
    <child>
      flag1
      flag2 # yaaaaaaaaaay
      flag3
      flag4 # yaaaaaaaaaay
    </child>
    <child>
      flag1 # yaaaaaaaaaay
      flag2
      flag3 # yaaaaaaaaaay
      flag4
    </child>
    # with following whitespace
    <child>
      flag1 
      flag2 
      flag3 
      flag4 
    </child>
CONFIG

    test 'create plugin via driver' do
      d = Fluent::Test::Driver::Input.new(AllBooleanParams)
      d.configure(CONFIG)
      assert_equal([true] * 4, [d.instance.flag1, d.instance.flag2, d.instance.flag3, d.instance.flag4])
      num_of_sections = 3
      assert_equal num_of_sections, d.instance.children.size
      assert_equal([true] * (num_of_sections * 4), d.instance.children.map{|c| [c.flag1, c.flag2, c.flag3, c.flag4]}.flatten)
    end
  end
end

Version data entries

234 entries across 234 versions & 7 rubygems

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/test/config/test_plugin_configuration.rb
fluentd-1.16.6-x86-mingw32 test/config/test_plugin_configuration.rb
fluentd-1.16.6-x64-mingw32 test/config/test_plugin_configuration.rb
fluentd-1.16.6-x64-mingw-ucrt test/config/test_plugin_configuration.rb
fluentd-1.16.6 test/config/test_plugin_configuration.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/test/config/test_plugin_configuration.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/test/config/test_plugin_configuration.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/test/config/test_plugin_configuration.rb
fluentd-1.17.0-x86-mingw32 test/config/test_plugin_configuration.rb
fluentd-1.17.0-x64-mingw-ucrt test/config/test_plugin_configuration.rb
fluentd-1.17.0-x64-mingw32 test/config/test_plugin_configuration.rb
fluentd-1.17.0 test/config/test_plugin_configuration.rb
fluentd-1.16.5-x64-mingw-ucrt test/config/test_plugin_configuration.rb
fluentd-1.16.5-x86-mingw32 test/config/test_plugin_configuration.rb
fluentd-1.16.5-x64-mingw32 test/config/test_plugin_configuration.rb
fluentd-1.16.5 test/config/test_plugin_configuration.rb
fluentd-1.16.4-x64-mingw-ucrt test/config/test_plugin_configuration.rb
fluentd-1.16.4-x86-mingw32 test/config/test_plugin_configuration.rb
fluentd-1.16.4-x64-mingw32 test/config/test_plugin_configuration.rb
fluentd-1.16.4 test/config/test_plugin_configuration.rb