Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix local feature testing by opt-in ENV variable in ci/docker

Oliver Günther4d02e3844af8
diff --git a/docker-compose.yml b/docker-compose.yml
index 4536dc0bdfc..c01fe0fb83e 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -141,7 +141,7 @@ services:
DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: "true"
SELENIUM_GRID_URL: http://selenium-hub:4444/wd/hub
CAPYBARA_SERVER_PORT: 3000
- CAPYBARA_DYNAMIC_HOSTNAME: 0
+ CAPYBARA_DYNAMIC_BIND_IP: 1
CAPYBARA_APP_HOSTNAME: backend-test
OPENPROJECT_DISABLE_DEV_ASSET_PROXY: 1
OPENPROJECT_TESTING_NO_HEADLESS: "true"
diff --git a/docker/ci/Dockerfile b/docker/ci/Dockerfile
index 368bbb2dba1..6dac1eeb466 100644
--- a/docker/ci/Dockerfile
+++ b/docker/ci/Dockerfile
@@ -18,7 +18,7 @@ ENV NODE_VERSION="12.18.3"
ENV BUNDLER_VERSION="2.1.4"
ENV BUNDLE_WITHOUT="development:production:docker"
ENV OPENPROJECT_DISABLE_DEV_ASSET_PROXY=1
-ENV CAPYBARA_DYNAMIC_HOSTNAME=0
+ENV CAPYBARA_DYNAMIC_BIND_IP=1
ENV CAPYBARA_DOWNLOADED_FILE_DIR=/tmp
# disable deprecations and other warnings in output
ENV RUBYOPT="-W0"
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index adec31b79ca..c7a0be6c277 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -15,14 +15,14 @@ RSpec.configure do |config|
end
Capybara.always_include_port = true
- ip_address = Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address
- hostname = ENV['CAPYBARA_DYNAMIC_HOSTNAME'].present? ? ip_address : ENV.fetch('CAPYBARA_APP_HOSTNAME', 'localhost')
- if ENV['TRAVIS']
- Capybara.server_host = "0.0.0.0"
- else
+ if ENV['CAPYBARA_DYNAMIC_BIND_IP']
+ ip_address = Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address
+ hostname = ENV.fetch('CAPYBARA_APP_HOSTNAME', ip_address)
Capybara.server_host = ip_address
+ Capybara.app_host = "http://#{hostname}"
+ else
+ Capybara.server_host = "0.0.0.0"
end
- Capybara.app_host = "http://#{hostname}"
end
##