Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait until @tails is set a new watcher #2896

Merged
merged 1 commit into from
Mar 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/plugin/test_in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1078,11 +1078,11 @@ def test_unwatched_files_should_be_removed
"refresh_interval" => 1,
})
d = create_driver(config, false)
d.run(expect_emits: 1, shutdown: false) do
d.end_if { d.instance.instance_variable_get(:@tails).keys.size >= 1 }
d.run(expect_emits: 1, shutdown: false, timeout: 1) do
File.open("#{TMP_DIR}/tail.txt", "ab") { |f| f.puts "test3\n" }
end

assert_equal 1, d.instance.instance_variable_get(:@tails).keys.size
cleanup_directory(TMP_DIR)
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 }
Expand Down