From d29755ce5493b0a514a7fe4b915d5d732c247600 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Wed, 19 Mar 2025 18:29:41 +0900 Subject: [PATCH] test_in_tail: add wait to detect rotation (#4874) **Which issue(s) this PR fixes**: Fixes #4079 **What this PR does / why we need it**: For reasons such as the load on the CI execution environment, looks like that rotation detection is delayed and the test does not execute as expected. For this reason, this patch adds a wait to ensure to detect the rotation. Before the patch was introduced, tests failed about once every 20 to 50 times. After, the test was successful 500 consecutive times. **Docs Changes**: **Release Note**: Signed-off-by: Shizuo Fujita Signed-off-by: Kentaro Hayashi --- test/plugin/test_in_tail.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/plugin/test_in_tail.rb b/test/plugin/test_in_tail.rb index 6b922ae601..54fb6e17b0 100644 --- a/test/plugin/test_in_tail.rb +++ b/test/plugin/test_in_tail.rb @@ -1611,6 +1611,7 @@ def test_unwatched_files_should_be_removed cleanup_file("#{@tmp_dir}/tail.txt") waiting(20) { sleep 0.1 until Dir.glob("#{@tmp_dir}/*.txt").size == 0 } # Ensure file is deleted on Windows + waiting(5) { sleep 0.1 until d.logs.last.include?("detected rotation") } waiting(5) { sleep 0.1 until d.instance.instance_variable_get(:@tails).keys.size <= 0 } assert_equal(