Skip to content

Commit

Permalink
in_tail: Make the new tests stable
Browse files Browse the repository at this point in the history
`sleep 1s` is too short for `enable_stat_watcher false`.

Signed-off-by: Daijiro Fukuda <fukuda@clear-code.com>
  • Loading branch information
daipom committed Mar 7, 2024
1 parent bbc83bc commit f1f7866
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/plugin/test_in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3049,13 +3049,13 @@ def test_next_rotation_occurs_very_fast_while_old_TW_still_waiting_rotate_wait
d.run(expect_records: 6, timeout: 15) do
Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt0", "ab") {|f| f.puts "file1 log2"}

sleep 1
sleep 1.5 # Need to be larger than 1s (the interval of watch_timer)

FileUtils.move("#{@tmp_dir}/tail.txt0", "#{@tmp_dir}/tail.txt" + "1")
Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt0", "wb") {|f| f.puts "file2 log1"}
Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt0", "ab") {|f| f.puts "file2 log2"}

sleep 1
sleep 1.5 # Need to be larger than 1s (the interval of watch_timer)

# Rotate again (Old TailWatcher waiting rotate_wait also calls update_watcher)
[1, 0].each do |i|
Expand Down Expand Up @@ -3233,13 +3233,13 @@ def test_next_rotation_occurs_very_fast_while_old_TW_still_waiting_rotate_wait
d.run(expect_records: 6, timeout: 15) do
Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt0", "ab") {|f| f.puts "file1 log2"}

sleep 1
sleep 1.5 # Need to be larger than 1s (the interval of watch_timer)

FileUtils.move("#{@tmp_dir}/tail.txt0", "#{@tmp_dir}/tail.txt" + "1")
Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt0", "wb") {|f| f.puts "file2 log1"}
Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt0", "ab") {|f| f.puts "file2 log2"}

sleep 1
sleep 1.5 # Need to be larger than 1s (the interval of watch_timer)

# Rotate again (Old TailWatcher waiting rotate_wait also calls update_watcher)
[1, 0].each do |i|
Expand Down

0 comments on commit f1f7866

Please sign in to comment.