Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-10 06:07:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-10 06:07:46 +0300
commitb24ae1cbc66e5b0f622393bcf2c59711750161ea (patch)
treede9514fdda81f7d8293612687026a87826b0d9dd /qa
parent775816e676aae53509d7b6f364945f2720636f72 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb3
-rw-r--r--qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb3
-rw-r--r--qa/qa/vendor/github/page/login.rb11
-rw-r--r--qa/qa/vendor/one_password/cli.rb35
-rwxr-xr-xqa/qa/vendor/one_password/darwin/opbin10616336 -> 11185296 bytes
-rwxr-xr-xqa/qa/vendor/one_password/linux/opbin9003392 -> 7712832 bytes
6 files changed, 43 insertions, 9 deletions
diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb
index 4fd80c353fb..a118176eb8a 100644
--- a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb
+++ b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb
@@ -1,8 +1,7 @@
# frozen_string_literal: true
module QA
- # Failure issue: https://gitlab.com/gitlab-org/gitlab/issues/36305
- context 'Manage', :orchestrated, :oauth, :skip do
+ context 'Manage', :orchestrated, :oauth do
describe 'OAuth login' do
it 'User logs in to GitLab with GitHub OAuth' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
diff --git a/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb b/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb
index d315bac2ffd..74e2f51cf28 100644
--- a/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb
+++ b/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb
@@ -1,8 +1,7 @@
# frozen_string_literal: true
module QA
- # https://gitlab.com/gitlab-org/gitlab/issues/38315
- context 'Performance bar', :quarantine do
+ context 'Performance bar' do
context 'when logged in as an admin user', :requires_admin do
before do
Flow::Login.sign_in_as_admin
diff --git a/qa/qa/vendor/github/page/login.rb b/qa/qa/vendor/github/page/login.rb
index 8dd79148043..4675e33b514 100644
--- a/qa/qa/vendor/github/page/login.rb
+++ b/qa/qa/vendor/github/page/login.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require 'capybara/dsl'
+require 'benchmark'
module QA
module Vendor
@@ -13,9 +14,15 @@ module QA
click_on 'Sign in'
Support::Retrier.retry_until(raise_on_failure: true, sleep_interval: 35) do
- otp = OnePassword::CLI.new.otp
+ fresh_otp = nil
- fill_in 'otp', with: otp
+ time = Benchmark.realtime do
+ fresh_otp = OnePassword::CLI.instance.fresh_otp
+ end
+
+ QA::Runtime::Logger.info("Returned fresh_otp: #{fresh_otp} in #{time} seconds")
+
+ fill_in 'otp', with: fresh_otp
click_on 'Verify'
diff --git a/qa/qa/vendor/one_password/cli.rb b/qa/qa/vendor/one_password/cli.rb
index 3cb69391783..cf8b7f8a4f9 100644
--- a/qa/qa/vendor/one_password/cli.rb
+++ b/qa/qa/vendor/one_password/cli.rb
@@ -1,9 +1,13 @@
# frozen_string_literal: true
+require 'benchmark'
+
module QA
module Vendor
module OnePassword
class CLI
+ include Singleton
+
def initialize
@email = QA::Runtime::Env.gitlab_qa_1p_email
@password = QA::Runtime::Env.gitlab_qa_1p_password
@@ -11,14 +15,39 @@ module QA
@github_uuid = QA::Runtime::Env.gitlab_qa_1p_github_uuid
end
- def otp
- `#{op_path} get totp #{@github_uuid} --session=#{session_token}`.to_i
+ def fresh_otp
+ otps = []
+
+ # Fetches a fresh OTP and returns it only after op provides the same OTP twice
+ # An OTP is valid for 30 seconds so 70 attempts with 0.5 interval would ensure we complete 1 cycle
+ Support::Retrier.retry_until(max_attempts: 70, sleep_interval: 0.5) do
+ otps << fetch_otp
+ otps.size >= 3 && otps[-1] == otps[-2] && otps[-1] != otps[-3]
+ end
+
+ otps.last
end
private
+ def fetch_otp
+ result = nil
+
+ time = Benchmark.realtime do
+ result = `#{op_path} get totp #{@github_uuid} --session=#{session_token}`.to_i
+ end
+
+ QA::Runtime::Logger.info("Fetched OTP: #{result} in: #{time} seconds")
+
+ result
+ end
+
+ # OP session tokens are valid for 30 minutes. We are caching the session token here and this is fine currently
+ # as we just have one test that is not expected to go over 30 minutes.
+ # But note that if we add more tests that use this class, we might need to add a mechanism to invalidate
+ # the cache after 30 minutes or if the session_token is rejected by op CLI.
def session_token
- `echo '#{@password}' | #{op_path} signin gitlab.1password.com #{@email} #{@secret} --output=raw --shorthand=gitlab_qa`
+ @session_token ||= `echo '#{@password}' | #{op_path} signin gitlab.1password.com #{@email} #{@secret} --output=raw --shorthand=gitlab_qa`
end
def op_path
diff --git a/qa/qa/vendor/one_password/darwin/op b/qa/qa/vendor/one_password/darwin/op
index 0f646522834..be7a3721b14 100755
--- a/qa/qa/vendor/one_password/darwin/op
+++ b/qa/qa/vendor/one_password/darwin/op
Binary files differ
diff --git a/qa/qa/vendor/one_password/linux/op b/qa/qa/vendor/one_password/linux/op
index 47ce87731be..47e79d7c599 100755
--- a/qa/qa/vendor/one_password/linux/op
+++ b/qa/qa/vendor/one_password/linux/op
Binary files differ