Skip to content

Commit c301faa

Browse files
daipomWatson1978
andauthored
Backport(v1.16): ci: remove reference to mock object after test (#5055) (#5086)
**Which issue(s) this PR fixes**: * Backport #5055 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 <fujita@clear-code.com> Signed-off-by: Daijiro Fukuda <fukuda@clear-code.com> Co-authored-by: Shizuo Fujita <fujita@clear-code.com>
1 parent 57d3738 commit c301faa

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

test/plugin/test_in_object_space.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ def test_configure
5050
end
5151

5252
def test_emit
53+
# Force release garbaged objects due to avoid unexpected error by mock objects on `on_timer`
54+
# https://github.com/fluent/fluentd/pull/5055
55+
GC.start
56+
5357
d = create_driver
5458

5559
d.run(expect_emits: 3)

test/plugin/test_input.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,7 @@ def emit(tag, es)
133133
assert{ @p.router.object_id != original_router.object_id }
134134

135135
@p.router.emit('mytag.testing', ['for mock'])
136+
ensure
137+
Fluent::Engine.root_agent.labels['@mytest'] = nil
136138
end
137139
end

test/plugin/test_out_forward.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def try_write(chunk)
344344
end
345345

346346
test 'set_compress_is_gzip_in_buffer_section' do
347-
mock = flexmock($log)
347+
mock = flexmock($log.dup)
348348
mock.should_receive(:log).with("buffer is compressed. If you also want to save the bandwidth of a network, Add `compress` configuration in <match>")
349349

350350
@d = d = create_driver(config + %[

test/plugin_helper/test_event_emitter.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ class Dummy < Fluent::Plugin::TestBase
7070
d.configure(config_element('ROOT', '', {'@label' => '@mytest'}))
7171
router = d.event_emitter_router("@mytest")
7272
assert_equal router_mock, router
73+
ensure
74+
Fluent::Engine.root_agent.labels['@mytest'] = nil
7375
end
7476

7577
test 'get root router' do

0 commit comments

Comments
 (0)