summaryrefslogtreecommitdiff
path: root/qa/qa
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-02-10 14:20:44 -0800
committerStan Hu <stanhu@gmail.com>2018-02-11 05:59:33 -0800
commitdc8cf732078dc03af52e4821683ea1c04946091e (patch)
treee650e989b486fc09dc1ab100087600f2206fcb92 /qa/qa
parent498ade4801a822f8704390b10d178af9fe7987cb (diff)
downloadgitlab-ce-dc8cf732078dc03af52e4821683ea1c04946091e.tar.gz
GitLab QA: Add GITLAB_USER_TYPE to support different login types (e.g. standard, LDAP)sh-add-login-types-qa
GITLAB_USERNAME and GITLAB_PASSWORD may be specified for an LDAP login, but QA scenarios may need to know which type it is in order to log in successfully.
Diffstat (limited to 'qa/qa')
-rw-r--r--qa/qa/page/main/login.rb10
-rw-r--r--qa/qa/runtime/env.rb10
-rw-r--r--qa/qa/runtime/user.rb4
3 files changed, 23 insertions, 1 deletions
diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb
index fd49b27cb1a..a8a5601dbe6 100644
--- a/qa/qa/page/main/login.rb
+++ b/qa/qa/page/main/login.rb
@@ -39,6 +39,14 @@ module QA
end
end
+ def sign_in_using_credentials
+ if Runtime::User.ldap_user?
+ sign_in_using_ldap_credentials
+ else
+ sign_in_using_gitlab_credentials
+ end
+ end
+
def sign_in_using_ldap_credentials
using_wait_time 0 do
set_initial_password_if_present
@@ -51,7 +59,7 @@ module QA
end
end
- def sign_in_using_credentials
+ def sign_in_using_gitlab_credentials
using_wait_time 0 do
set_initial_password_if_present
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb
index 115d5ee58d1..5401372e225 100644
--- a/qa/qa/runtime/env.rb
+++ b/qa/qa/runtime/env.rb
@@ -17,6 +17,16 @@ module QA
ENV['PERSONAL_ACCESS_TOKEN']
end
+ # By default, "standard" denotes a standard GitLab user login.
+ # Set this to "ldap" if the user should be logged in via LDAP.
+ def user_type
+ (ENV['GITLAB_USER_TYPE'] || 'standard').tap do |type|
+ unless %w(ldap standard).include?(type)
+ raise ArgumentError.new("Invalid user type '#{type}': must be 'ldap' or 'standard'")
+ end
+ end
+ end
+
def user_username
ENV['GITLAB_USERNAME']
end
diff --git a/qa/qa/runtime/user.rb b/qa/qa/runtime/user.rb
index 6b377f6b287..39e6adf9522 100644
--- a/qa/qa/runtime/user.rb
+++ b/qa/qa/runtime/user.rb
@@ -10,6 +10,10 @@ module QA
def password
Runtime::Env.user_password || '5iveL!fe'
end
+
+ def ldap_user?
+ Runtime::Env.user_type == 'ldap'
+ end
end
end
end