From 6ace9ef4e8ce8fe5f4f2f4fc86510325b9eafa91 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Fri, 6 Nov 2026 11:44:30 +0900 Subject: [PATCH] test_in_tail: fix flaky worker unwatch test by disabling the periodic refresh test_worker_completion_drains_file_during_unwatch unwatches the file, but the file still matches path. The periodic refresh finds it again and reads it from the head, so the line is emitted twice if the test runs longer than about one second. create_driver(config) puts the common config on the left of +, and the left side wins. So the refresh_interval and rotate_wait of the neighboring rotation test were not applied either. Configure both tests without the common config. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Shizuo Fujita --- test/plugin/test_in_tail.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/plugin/test_in_tail.rb b/test/plugin/test_in_tail.rb index 25b6a388f9..ae992d60df 100644 --- a/test/plugin/test_in_tail.rb +++ b/test/plugin/test_in_tail.rb @@ -836,13 +836,16 @@ def test_worker_completion_detects_rotation_and_drains_both_files path = "#{@tmp_dir}/tail.txt" Fluent::FileWrapper.open(path, 'wb') {} config = CONFIG_READ_FROM_HEAD + SINGLE_LINE_CONFIG + config_element('', '', { + 'path' => path, + 'pos_file' => "#{@tmp_dir}/tail.pos", + 'tag' => 't1', 'num_threads' => 2, 'read_lines_limit' => 1, 'rotate_wait' => '1s', 'refresh_interval' => '1h', 'enable_stat_watcher' => false, }) - driver = create_driver(config) + driver = create_driver(config, false) parse_started = Queue.new continue_parse = Queue.new @@ -869,12 +872,16 @@ def test_worker_completion_drains_file_during_unwatch path = "#{@tmp_dir}/tail.txt" Fluent::FileWrapper.open(path, 'wb') {} config = CONFIG_READ_FROM_HEAD + SINGLE_LINE_CONFIG + config_element('', '', { + 'path' => path, + 'pos_file' => "#{@tmp_dir}/tail.pos", + 'tag' => 't1', 'num_threads' => 2, 'read_lines_limit' => 1, + 'refresh_interval' => '1h', 'enable_stat_watcher' => true, 'enable_watch_timer' => false, }) - driver = create_driver(config) + driver = create_driver(config, false) parse_started = Queue.new continue_parse = Queue.new position_entry = nil