diff options
author | John Jarvis <jarv@gitlab.com> | 2018-11-28 14:11:05 +0100 |
---|---|---|
committer | John Jarvis <jarv@gitlab.com> | 2018-11-28 14:11:05 +0100 |
commit | 8cfefefaced4a0c9283c6d81d4f77cc8c3bd353f (patch) | |
tree | 5a690a55a0a04ef36213f58c9c70e09e9ac10719 /qa | |
parent | c43af89748674a20c80c0efb977769df011e8c41 (diff) | |
download | gitlab-ce-8cfefefaced4a0c9283c6d81d4f77cc8c3bd353f.tar.gz |
Adds QA_COOKIES option to gitlab-qa
Diffstat (limited to 'qa')
-rw-r--r-- | qa/README.md | 9 | ||||
-rw-r--r-- | qa/qa/runtime/browser.rb | 9 | ||||
-rw-r--r-- | qa/qa/runtime/env.rb | 4 |
3 files changed, 22 insertions, 0 deletions
diff --git a/qa/README.md b/qa/README.md index 746bd5cf94b..08ba59e117d 100644 --- a/qa/README.md +++ b/qa/README.md @@ -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). +### 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 Once you have made changes to the CE/EE repositories, you may want to build a diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb index 9aaf57e8d83..7fd2ba25527 100644 --- a/qa/qa/runtime/browser.rb +++ b/qa/qa/runtime/browser.rb @@ -117,6 +117,15 @@ module QA def perform(&block) 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? end diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 7b2768548dd..3bc2b44ccd8 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -38,6 +38,10 @@ module QA ENV['CI'] || ENV['CI_SERVER'] end + def qa_cookies + ENV['QA_COOKIES'] && ENV['QA_COOKIES'].split(';') + end + def signup_disabled? enabled?(ENV['SIGNUP_DISABLED'], default: false) end |