Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix system tests stuck on flock (#25495)

Alan Guo Xiang Tan0bd3e03144e9
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 528bfaa6ba3..3969532bfe4 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -573,7 +573,7 @@ RSpec.configure do |config|
# The long term fix here is to get `selenium-manager` to download the `chromedriver` binary to a unique path for each
# process but the `--cache-path` option for `selenium-manager` is currently not supported in `selenium-webdriver`.
if !File.directory?(File.expand_path("~/.cache/selenium"))
- File.open("#{Rails.root}/tmp/chrome_driver_flock", "w") do |file|
+ File.open("#{Rails.root}/tmp/chrome_driver_flock", File::RDWR | File::CREAT, 0644) do |file|
file.flock(File::LOCK_EX)
`#{Selenium::WebDriver::SeleniumManager.send(:binary)} --browser chrome`
end