Commit 8cfefefa authored by John Jarvis's avatar John Jarvis

Adds QA_COOKIES option to gitlab-qa

parent c43af897
...@@ -80,6 +80,15 @@ GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password GITLAB_SANDBOX_NAME=jsmith-qa-sa ...@@ -80,6 +80,15 @@ GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password GITLAB_SANDBOX_NAME=jsmith-qa-sa
All [supported environment variables are here](https://gitlab.com/gitlab-org/gitlab-qa/blob/master/docs/what_tests_can_be_run.md#supported-environment-variables). All [supported environment variables are here](https://gitlab.com/gitlab-org/gitlab-qa/blob/master/docs/what_tests_can_be_run.md#supported-environment-variables).
### Sending additional cookies
The environment variable `QA_COOKIES` can be set to send additional cookies
on every request. This is necessary on gitlab.com to direct traffic to the
canary fleet. To do this set `QA_COOKIES="gitlab_canary=true"`.
To set multiple cookies, separate them with the `;` character, for example: `QA_COOKIES="cookie1=value;cookie2=value2"`
### Building a Docker image to test ### Building a Docker image to test
Once you have made changes to the CE/EE repositories, you may want to build a Once you have made changes to the CE/EE repositories, you may want to build a
......
...@@ -117,6 +117,15 @@ module QA ...@@ -117,6 +117,15 @@ module QA
def perform(&block) def perform(&block)
visit(url) visit(url)
if QA::Runtime::Env.qa_cookies
browser = Capybara.current_session.driver.browser
QA::Runtime::Env.qa_cookies.each do |cookie|
name, value = cookie.split("=")
value ||= ""
browser.manage.add_cookie name: name, value: value
end
end
yield.tap { clear! } if block_given? yield.tap { clear! } if block_given?
end end
......
...@@ -38,6 +38,10 @@ module QA ...@@ -38,6 +38,10 @@ module QA
ENV['CI'] || ENV['CI_SERVER'] ENV['CI'] || ENV['CI_SERVER']
end end
def qa_cookies
ENV['QA_COOKIES'] && ENV['QA_COOKIES'].split(';')
end
def signup_disabled? def signup_disabled?
enabled?(ENV['SIGNUP_DISABLED'], default: false) enabled?(ENV['SIGNUP_DISABLED'], default: false)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment