Skip to content

Commit ff454c2

Browse files
committed
test_in_tail: fix flaky tests for file rotation
Signed-off-by: Shizuo Fujita <[email protected]>
1 parent eebc7e1 commit ff454c2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/plugin/test_in_tail.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3265,6 +3265,7 @@ def test_refreshTW_during_rotation
32653265
inode_0 = tail_watchers[0]&.ino
32663266
inode_1 = tail_watchers[1]&.ino
32673267
inode_2 = tail_watchers[2]&.ino
3268+
pos_file_inode = tail_watchers[2]&.pe&.read_inode
32683269
record_values = d.events.collect { |event| event[2]["message"] }.sort
32693270
position_entries = []
32703271
Fluent::FileWrapper.open("#{@tmp_dir}/tail.pos", "r") do |f|
@@ -3282,7 +3283,7 @@ def test_refreshTW_during_rotation
32823283
tail_watcher_io_handler_opened_statuses: [false, false, false],
32833284
position_entries: [
32843285
# The recorded path is old, but it is no problem. The path is not used when using follow_inodes.
3285-
["#{@tmp_dir}/tail.txt0", "0000000000000016", inode_2],
3286+
["#{@tmp_dir}/tail.txt0", "0000000000000016", pos_file_inode],
32863287
],
32873288
},
32883289
{
@@ -3346,6 +3347,7 @@ def test_next_rotation_occurs_very_fast_while_old_TW_still_waiting_rotate_wait
33463347
inode_0 = tail_watchers[0]&.ino
33473348
inode_1 = tail_watchers[1]&.ino
33483349
inode_2 = tail_watchers[2]&.ino
3350+
pos_file_inode = tail_watchers[2]&.pe&.read_inode
33493351
record_values = d.events.collect { |event| event[2]["message"] }.sort
33503352
position_entries = []
33513353
Fluent::FileWrapper.open("#{@tmp_dir}/tail.pos", "r") do |f|
@@ -3362,7 +3364,7 @@ def test_next_rotation_occurs_very_fast_while_old_TW_still_waiting_rotate_wait
33623364
tail_watcher_inodes: [inode_0, inode_1, inode_2],
33633365
tail_watcher_io_handler_opened_statuses: [false, false, false],
33643366
position_entries: [
3365-
["#{@tmp_dir}/tail.txt0", "0000000000000016", inode_2],
3367+
["#{@tmp_dir}/tail.txt0", "0000000000000016", pos_file_inode],
33663368
],
33673369
},
33683370
{

0 commit comments

Comments
 (0)