Sha256: f94455cb7a80b7f964b94b9eefbefc49de3f263f522bfa5201731e3d9faf910e

Contents?: true

Size: 1.07 KB

Versions: 280

Compression:

Stored size: 1.07 KB

Contents

require_relative '../helper'
require 'fluent/plugin/base'
require 'fluent/plugin/input'
require 'fluent/plugin/owned_by_mixin'

module OwnedByMixinTestEnv
  class DummyParent < Fluent::Plugin::Input
    Fluent::Plugin.register_input('dummy_parent', self)
  end
  class DummyChild < Fluent::Plugin::Base
    include Fluent::Plugin::OwnedByMixin
    Fluent::Plugin.register_parser('dummy_child', self)
  end
end

class OwnedByMixinTest < Test::Unit::TestCase
  sub_test_case 'Owned plugins' do
    setup do
      Fluent::Test.setup
    end

    test 'inherits plugin id and logger from parent' do
      parent = Fluent::Plugin.new_input('dummy_parent')
      parent.configure(config_element('ROOT', '', {'@id' => 'my_parent_id', '@log_level' => 'trace'}))
      child = Fluent::Plugin.new_parser('dummy_child', parent: parent)

      assert_equal parent.object_id, child.owner.object_id

      assert child.instance_eval{ @_plugin_id_configured }
      assert_equal 'my_parent_id', child.instance_eval{ @_plugin_id }

      assert_equal Fluent::Log::LEVEL_TRACE, child.log.level
    end
  end
end

Version data entries

280 entries across 280 versions & 4 rubygems

Version Path
fluentd-1.15.0-x86-mingw32 test/plugin/test_owned_by.rb
fluentd-1.15.0-x64-mingw-ucrt test/plugin/test_owned_by.rb
fluentd-1.15.0-x64-mingw32 test/plugin/test_owned_by.rb
fluentd-1.15.0 test/plugin/test_owned_by.rb
dtomasgu-fluentd-1.14.8.pre.dev test/plugin/test_owned_by.rb
dtomasgu-fluentd-1.14.7.pre.dev test/plugin/test_owned_by.rb
fluentd-1.14.6-x86-mingw32 test/plugin/test_owned_by.rb
fluentd-1.14.6-x64-mingw-ucrt test/plugin/test_owned_by.rb
fluentd-1.14.6-x64-mingw32 test/plugin/test_owned_by.rb
fluentd-1.14.6 test/plugin/test_owned_by.rb
fluentd-1.14.5-x64-mingw-ucrt test/plugin/test_owned_by.rb
fluentd-1.14.5-x86-mingw32 test/plugin/test_owned_by.rb
fluentd-1.14.5-x64-mingw32 test/plugin/test_owned_by.rb
fluentd-1.14.5 test/plugin/test_owned_by.rb
fluentd-1.14.4-x64-mingw-ucrt test/plugin/test_owned_by.rb
fluentd-1.14.4-x64-mingw32 test/plugin/test_owned_by.rb
fluentd-1.14.4-x86-mingw32 test/plugin/test_owned_by.rb
fluentd-1.14.4 test/plugin/test_owned_by.rb
fluentd-1.14.3-x86-mingw32 test/plugin/test_owned_by.rb
fluentd-1.14.3-x64-mingw32 test/plugin/test_owned_by.rb