Describe the bug
The test_unwatched_files_should_be_removed test fails sometimes.
Failure: test_unwatched_files_should_be_removed(TailInputTest::path)
/Users/runner/work/fluentd/fluentd/test/plugin/test_in_tail.rb:1616:in `test_unwatched_files_should_be_removed'
1613: waiting(20) { sleep 0.1 until Dir.glob("#{@tmp_dir}/*.txt").size == 0 } # Ensure file is deleted on Windows
1614: waiting(5) { sleep 0.1 until d.instance.instance_variable_get(:@tails).keys.size <= 0 }
1615:
=> 1616: assert_equal(
1617: {
1618: files: [],
1619: tails: []
<{:files=>[], :tails=>[]}> expected but was
<{:files=>[],
:tails=>
["/Users/runner/work/fluentd/fluentd/test/plugin/../tmp/tail/dcebe801d2a39d7ba0fc/tail.txt"]}>
diff:
? {:files=>[], :tails=>[]}
+ :tails=>
+ ["/Users/runner/work/fluentd/fluentd/test/plugin/../tmp/tail/dcebe801d2a39d7ba0fc/tail.txt"]}
|
def test_unwatched_files_should_be_removed |
|
config = config_element("", "", { |
|
"tag" => "tail", |
|
"path" => "#{@tmp_dir}/*.txt", |
|
"format" => "none", |
|
"pos_file" => "#{@tmp_dir}/tail.pos", |
|
"read_from_head" => true, |
|
"refresh_interval" => 1, |
|
}) |
|
d = create_driver(config, false) |
|
d.end_if { d.instance.instance_variable_get(:@tails).keys.size >= 1 } |
|
d.run(expect_emits: 1, shutdown: false) do |
|
Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt", "ab") { |f| f.puts "test3\n" } |
|
end |
|
|
|
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.instance.instance_variable_get(:@tails).keys.size <= 0 } |
|
|
|
assert_equal( |
|
{ |
|
files: [], |
|
tails: [] |
|
}, |
|
{ |
|
files: Dir.glob("#{@tmp_dir}/*.txt"), |
|
tails: d.instance.instance_variable_get(:@tails).keys |
|
} |
|
) |
|
ensure |
|
d.instance_shutdown if d && d.instance |
|
cleanup_directory(@tmp_dir) |
|
end |
|
|
|
def count_timer_object |
|
num = 0 |
|
ObjectSpace.each_object(Fluent::PluginHelper::Timer::TimerWatcher) { |obj| |
|
num += 1 |
|
} |
|
num |
|
end |
|
end |
To Reproduce
I can't reproduce this on my local yet.
In CI, I have confirmed this on Ruby 2.7 on macos-latest.
Not sure if this is related to Ruby version or OS.
Expected behavior
The test always succeeds.
Your Environment
Your Configuration
Your Error Log
Additional context
No response
Describe the bug
The
test_unwatched_files_should_be_removedtest fails sometimes.fluentd/test/plugin/test_in_tail.rb
Lines 1597 to 1638 in 8e9f46a
To Reproduce
I can't reproduce this on my local yet.
In CI, I have confirmed this on
Ruby 2.7 on macos-latest.Not sure if this is related to Ruby version or OS.
Expected behavior
The test always succeeds.
Your Environment
Your Configuration
Your Error Log
Additional context
No response