Sha256: 83c0a1f836da6a68ce5fc153a4b74caa4d93ef198dfdc741e19e76fe55533b23

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 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_equal 'my_parent_id', child.instance_eval{ @_plugin_id }

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

Version data entries

9 entries across 9 versions & 5 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/plugin/test_owned_by.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/test/plugin/test_owned_by.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/test/plugin/test_owned_by.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/test/plugin/test_owned_by.rb
fluentd-1.17.0-x86-mingw32 test/plugin/test_owned_by.rb
fluentd-1.17.0-x64-mingw-ucrt test/plugin/test_owned_by.rb
fluentd-1.17.0-x64-mingw32 test/plugin/test_owned_by.rb
fluentd-1.17.0 test/plugin/test_owned_by.rb
fluentd222-1.16.2-x86_64-linux test/plugin/test_owned_by.rb