diff options
Diffstat (limited to 'qa/qa/vendor')
-rw-r--r-- | qa/qa/vendor/github/page/base.rb | 14 | ||||
-rw-r--r-- | qa/qa/vendor/github/page/login.rb | 38 | ||||
-rw-r--r-- | qa/qa/vendor/one_password/cli.rb | 63 | ||||
-rwxr-xr-x | qa/qa/vendor/one_password/darwin/op | bin | 11185296 -> 0 bytes | |||
-rwxr-xr-x | qa/qa/vendor/one_password/linux/op | bin | 7712832 -> 0 bytes |
5 files changed, 0 insertions, 115 deletions
diff --git a/qa/qa/vendor/github/page/base.rb b/qa/qa/vendor/github/page/base.rb deleted file mode 100644 index 3b96180afe9..00000000000 --- a/qa/qa/vendor/github/page/base.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module QA - module Vendor - module Github - module Page - class Base - include Capybara::DSL - include Scenario::Actable - end - end - end - end -end diff --git a/qa/qa/vendor/github/page/login.rb b/qa/qa/vendor/github/page/login.rb deleted file mode 100644 index 4675e33b514..00000000000 --- a/qa/qa/vendor/github/page/login.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require 'capybara/dsl' -require 'benchmark' - -module QA - module Vendor - module Github - module Page - class Login < Page::Base - def login - fill_in 'login', with: QA::Runtime::Env.github_username - fill_in 'password', with: QA::Runtime::Env.github_password - click_on 'Sign in' - - Support::Retrier.retry_until(raise_on_failure: true, sleep_interval: 35) do - fresh_otp = nil - - 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' - - !has_text?('Two-factor authentication failed', wait: 1.0) - end - - click_on 'Authorize gitlab-qa' if has_button?('Authorize gitlab-qa') - end - end - end - end - end -end diff --git a/qa/qa/vendor/one_password/cli.rb b/qa/qa/vendor/one_password/cli.rb deleted file mode 100644 index cf8b7f8a4f9..00000000000 --- a/qa/qa/vendor/one_password/cli.rb +++ /dev/null @@ -1,63 +0,0 @@ -# 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 - @secret = QA::Runtime::Env.gitlab_qa_1p_secret - @github_uuid = QA::Runtime::Env.gitlab_qa_1p_github_uuid - end - - 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 - @session_token ||= `echo '#{@password}' | #{op_path} signin gitlab.1password.com #{@email} #{@secret} --output=raw --shorthand=gitlab_qa` - end - - def op_path - File.expand_path(File.join(%W[qa vendor one_password #{os} op])) - end - - def os - RUBY_PLATFORM.include?("darwin") ? "darwin" : "linux" - end - end - end - end -end diff --git a/qa/qa/vendor/one_password/darwin/op b/qa/qa/vendor/one_password/darwin/op Binary files differdeleted file mode 100755 index be7a3721b14..00000000000 --- a/qa/qa/vendor/one_password/darwin/op +++ /dev/null diff --git a/qa/qa/vendor/one_password/linux/op b/qa/qa/vendor/one_password/linux/op Binary files differdeleted file mode 100755 index 47e79d7c599..00000000000 --- a/qa/qa/vendor/one_password/linux/op +++ /dev/null |