Skip to content

Commit

Permalink
test_in_tail: Make sure to clean up pos file
Browse files Browse the repository at this point in the history
In addition, show a message when fails to remove temp files.

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
  • Loading branch information
ashie committed Jun 1, 2022
1 parent 65af256 commit 9dfc0d3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/plugin/test_in_tail.rb
Expand Up @@ -34,8 +34,9 @@ def cleanup_directory(path)
Dir.glob("*", base: path).each do |name|
begin
cleanup_file(File.join(path, name))
rescue
rescue => e
# expect test driver block release already owned file handle.
puts "Failed to clean up #{File.join(path, name)}: #{e}"
end
end
else
Expand Down Expand Up @@ -978,6 +979,7 @@ def test_rotate_file_with_write_old_and_no_new_file(data)
end

def sub_test_rotate_file(config = nil, expect_emits: nil, expect_records: nil, timeout: 5)
File.open("#{TMP_DIR}/tail.pos", "wb") { |f| }
file = Fluent::FileWrapper.open("#{TMP_DIR}/tail.txt", "wb")
file.puts "test1"
file.puts "test2"
Expand Down

0 comments on commit 9dfc0d3

Please sign in to comment.