Skip to content

Commit cda652b

Browse files
Watson1978github-actions[bot]
authored andcommitted
test_in_tail: relax too-tight timeouts in file-appended-after-start tests (#5446)
**Which issue(s) this PR fixes**: Fixes # **What this PR does / why we need it**: `test_emit_with_read_lines_limit[flat 1]` fails intermittently on CI (Ruby 3.4, windows-11-arm) with: ``` 3) Failure: test_emit_with_read_lines_limit[flat 1](TailInputTest::singleline) C:/a/fluentd/fluentd/test/plugin/test_in_tail.rb:509:in 'TailInputTest::TEST_VGFpbElucHV0VGVzdDo6c2luZ2xlbGluZQ#test_emit_with_read_lines_limit' 506: end 507: 508: events = d.events => 509: assert_equal(true, events.length > 0) 510: assert_equal({"message" => msg}, events[0][2]) 511: assert_equal({"message" => msg}, events[1][2]) 512: assert num_events <= d.emit_count <true> expected but was <false> diff: ? tru e ? fals ? ??? Error: <true> expected but was <false>. ``` https://github.com/fluent/fluentd/actions/runs/29549033055/job/87787458652#step:6:5460 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. 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) **Docs Changes**: N/A **Release Note**: N/A Signed-off-by: Shizuo Fujita <fujita@clear-code.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 0579b12 commit cda652b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

test/plugin/test_in_tail.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ def test_emit_with_read_lines_limit(data)
498498
d = create_driver(config)
499499
msg = 'test' * 2000 # in_tail reads 8192 bytes at once.
500500

501-
d.run(expect_emits: num_events, timeout: 2) do
501+
d.run(expect_emits: num_events, timeout: 10) do
502502
Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt", "ab") {|f|
503503
f.puts msg
504504
f.puts msg
@@ -784,7 +784,7 @@ def test_watch_wildcard_path_without_watch_timer
784784

785785
d = create_driver(config, false)
786786

787-
d.run(expect_emits: 1, timeout: 1) do
787+
d.run(expect_emits: 1, timeout: 10) do
788788
Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt", "ab") {|f|
789789
f.puts "test3"
790790
f.puts "test4"
@@ -826,7 +826,7 @@ def test_emit_with_disable_stat_watcher(data)
826826
def test_always_read_from_head_on_detecting_a_new_file
827827
d = create_driver(SINGLE_LINE_CONFIG)
828828

829-
d.run(expect_emits: 1, timeout: 3) do
829+
d.run(expect_emits: 1, timeout: 10) do
830830
Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt", "wb") {|f|
831831
f.puts "test1\ntest2\n"
832832
}

0 commit comments

Comments
 (0)