Test running error of address already in use
ZoharLiran opened this issue · 1 comments
ZoharLiran commented
I have one simple test that is passing when it is ran not in parallel.
When I run it using the parallel gem I am getting:
Errno::EADDRINUSE:
Address already in use - bind(2) for 127.0.0.1:9887
Here is my helper:
Capybara.server_port = 9887 + ENV['TEST_ENV_NUMBER'].to_i
Capybara.run_server = true
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end
Capybara.app_host = "http://localhost.autodesk.com:#{Capybara.server_port}"
Capybara.default_driver = :selenium
Capybara.javascript_driver = :selenium
RSpec.configure do |config|
if local_selenium?
config.before(:each) do
Capybara.page.driver.browser.manage.window.resize_to(
*SCREEN_SIZE.split('x')
)
end
end
end
I am not sure this is an issue with the gem, but I am not seeing anything on stackoverflow regarding this. am I setting up the port and server in the correct way?
it seems like Capybara is trying to start a new rack application on every process. any ideas on how to prevent it? should this be something that we incorporate into the gem?
ZoharLiran commented
Closing the issue since I was using multitask
which calls parallel_split_test
multiple times and each one of those runs is actually trying to start from ENV['TEST_ENV_NUMBER']
being 0