summaryrefslogtreecommitdiff
path: root/qa/qa/runtime/env.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/runtime/env.rb')
-rw-r--r--qa/qa/runtime/env.rb42
1 files changed, 40 insertions, 2 deletions
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb
index 677fba7ced7..804ebf27851 100644
--- a/qa/qa/runtime/env.rb
+++ b/qa/qa/runtime/env.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require 'gitlab/qa'
+require 'uri'
module QA
module Runtime
@@ -23,10 +24,39 @@ module QA
SUPPORTED_FEATURES
end
- def dot_com?
- Runtime::Scenario.gitlab_address.include?(".com")
+ def address_matches?(*options)
+ return false unless Runtime::Scenario.attributes[:gitlab_address]
+
+ opts = {}
+ opts[:domain] = '.+'
+ opts[:tld] = '.com'
+
+ uri = URI(Runtime::Scenario.gitlab_address)
+
+ if options.any?
+ options.each do |option|
+ opts[:domain] = 'gitlab' if option == :production
+
+ if option.is_a?(Hash) && !option[:subdomain].nil?
+ opts.merge!(option)
+
+ opts[:subdomain] = case option[:subdomain]
+ when Array
+ "(#{option[:subdomain].join("|")})."
+ when Regexp
+ option[:subdomain]
+ else
+ "(#{option[:subdomain]})."
+ end
+ end
+ end
+ end
+
+ uri.host.match?(/^#{opts[:subdomain]}#{opts[:domain]}#{opts[:tld]}$/)
end
+ alias_method :dot_com?, :address_matches?
+
def additional_repository_storage
ENV['QA_ADDITIONAL_REPOSITORY_STORAGE']
end
@@ -194,6 +224,14 @@ module QA
ENV['GITLAB_QA_PASSWORD_6']
end
+ def gitlab_qa_2fa_owner_username_1
+ ENV['GITLAB_QA_2FA_OWNER_USERNAME_1'] || 'gitlab-qa-2fa-owner-user1'
+ end
+
+ def gitlab_qa_2fa_owner_password_1
+ ENV['GITLAB_QA_2FA_OWNER_PASSWORD_1']
+ end
+
def gitlab_qa_1p_email
ENV['GITLAB_QA_1P_EMAIL']
end