From 45de0b0108586fdf5b7dbe561bdabed268359d85 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Sun, 19 Jul 2026 17:42:20 +0900 Subject: [PATCH] test_in_tail: relax too-tight timeouts in file-appended-after-start tests `test_emit_with_read_lines_limit[flat 1]` fails intermittently on CI (Ruby 3.4, windows-11-arm) with: test/plugin/test_in_tail.rb:509 assert_equal(true, events.length > 0) expected but was i.e. no event was emitted within the 2s timeout. These tests create/append the target file *after* `d.run` starts, so the new content is only picked up by the periodic `refresh_watchers` timer (refresh_interval = 1s here). The first emit is therefore structurally pinned to ~1s regardless of machine speed, and `timeout: 2` leaves only ~1s of margin. A timeout threshold sweep (30 runs each) shows both macOS and Windows 11 ARM share the ~1s floor (0.8s always fails), but Windows has large jitter around it (13/30 fail at timeout 1.0s vs 0/30 on macOS). On the slower, more-contended windows-11-arm CI runner that jitter occasionally exceeds the 2s timeout, causing the flake. `expect_emits:` returns as soon as the expected emits arrive (~1s), so raising the timeout does not slow the passing case; a real "no emit" regression is still caught, just after 10s instead of 2s. Relax the timeouts of the three in_tail tests that share this "file activity after run starts + short timeout" shape: - test_emit_with_read_lines_limit: 2 -> 10 - test_always_read_from_head_on_detecting_a_new_file: 3 -> 10 - test_watch_wildcard_path_without_watch_timer: 1 -> 10 (Linux-only, but had the tightest timeout) Signed-off-by: Shizuo Fujita --- test/plugin/test_in_tail.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/plugin/test_in_tail.rb b/test/plugin/test_in_tail.rb index a5c389aafb..e5e1c15bd9 100644 --- a/test/plugin/test_in_tail.rb +++ b/test/plugin/test_in_tail.rb @@ -498,7 +498,7 @@ def test_emit_with_read_lines_limit(data) d = create_driver(config) msg = 'x' * 65000 # in_tail reads 65536 bytes at once. - d.run(expect_emits: num_events, timeout: 2) do + d.run(expect_emits: num_events, timeout: 10) do Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt", "ab") {|f| f.puts msg f.puts msg @@ -792,7 +792,7 @@ def test_watch_wildcard_path_without_watch_timer d = create_driver(config, false) - d.run(expect_emits: 1, timeout: 1) do + d.run(expect_emits: 1, timeout: 10) do Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt", "ab") {|f| f.puts "test3" f.puts "test4" @@ -834,7 +834,7 @@ def test_emit_with_disable_stat_watcher(data) def test_always_read_from_head_on_detecting_a_new_file d = create_driver(SINGLE_LINE_CONFIG) - d.run(expect_emits: 1, timeout: 3) do + d.run(expect_emits: 1, timeout: 10) do Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt", "wb") {|f| f.puts "test1\ntest2\n" }