diff --git a/test/plugin/test_in_object_space.rb b/test/plugin/test_in_object_space.rb index 6e8bfa524b..64e3c74e06 100644 --- a/test/plugin/test_in_object_space.rb +++ b/test/plugin/test_in_object_space.rb @@ -50,6 +50,10 @@ def test_configure end def test_emit + # Force release garbaged objects due to avoid unexpected error by mock objects on `on_timer` + # https://github.com/fluent/fluentd/pull/5055 + GC.start + d = create_driver d.run(expect_emits: 3) diff --git a/test/plugin/test_input.rb b/test/plugin/test_input.rb index d6e68599d9..98e5b5e2e5 100644 --- a/test/plugin/test_input.rb +++ b/test/plugin/test_input.rb @@ -133,5 +133,7 @@ def emit(tag, es) assert{ @p.router.object_id != original_router.object_id } @p.router.emit('mytag.testing', ['for mock']) + ensure + Fluent::Engine.root_agent.labels['@mytest'] = nil end end diff --git a/test/plugin/test_out_forward.rb b/test/plugin/test_out_forward.rb index c2442b631a..03cea05c37 100644 --- a/test/plugin/test_out_forward.rb +++ b/test/plugin/test_out_forward.rb @@ -344,7 +344,7 @@ def try_write(chunk) end test 'set_compress_is_gzip_in_buffer_section' do - mock = flexmock($log) + mock = flexmock($log.dup) mock.should_receive(:log).with("buffer is compressed. If you also want to save the bandwidth of a network, Add `compress` configuration in ") @d = d = create_driver(config + %[ diff --git a/test/plugin_helper/test_event_emitter.rb b/test/plugin_helper/test_event_emitter.rb index 409b9800bf..4e7543210a 100644 --- a/test/plugin_helper/test_event_emitter.rb +++ b/test/plugin_helper/test_event_emitter.rb @@ -70,6 +70,8 @@ class Dummy < Fluent::Plugin::TestBase d.configure(config_element('ROOT', '', {'@label' => '@mytest'})) router = d.event_emitter_router("@mytest") assert_equal router_mock, router + ensure + Fluent::Engine.root_agent.labels['@mytest'] = nil end test 'get root router' do