From de93fa17d14e56f52eb6237cdd1d3824996a760c Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Mon, 18 Aug 2025 10:44:29 +0900 Subject: [PATCH 1/2] ci: remove reference to mock object after test (#5055) **Which issue(s) this PR fixes**: Fixes #5054 **What this PR does / why we need it**: This PR will resolve CI error. **Docs Changes**: N/A **Release Note**: N/A --------- Signed-off-by: Shizuo Fujita Signed-off-by: Daijiro Fukuda --- test/plugin/test_in_object_space.rb | 4 ++++ test/plugin/test_input.rb | 2 ++ test/plugin_helper/test_event_emitter.rb | 2 ++ 3 files changed, 8 insertions(+) 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_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 From 564702935d72a60d4d7a2c053d0ffb30157e2155 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Thu, 11 Sep 2025 14:03:52 +0900 Subject: [PATCH 2/2] test_out_forward: mock a duplicated object Signed-off-by: Shizuo Fujita --- test/plugin/test_out_forward.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 + %[