Merge pull request #3715 from stonezdj/ldap_e2e

Add LDAP e2e test
This commit is contained in:
Daniel Jiang 2017-12-01 10:57:38 +08:00 committed by GitHub
commit c7790ff37e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 4 deletions

View File

@ -1,3 +1,4 @@
# User entry doesn't belong to harbor_users, it should fail to login
dn: uid=test,dc=example,dc=com
uid: test
cn: test
@ -12,3 +13,41 @@ gidNumber: 1001
userPassword: 123456
mail: test@example.com
gecos: test
# OU for People
dn: ou=people,dc=example,dc=com
objectClass: organizationalUnit
ou: People
# OU for Groups
dn: ou=groups,dc=example,dc=com
objectClass: organizationalUnit
ou: Groups
# Group Entry harbor_users
dn: cn=harbor_users,ou=groups,dc=example,dc=com
cn: harbor_users
description: All users
member: cn=mike,ou=people,dc=example,dc=com
objectclass: groupOfNames
objectclass: top
# User belongs to harbor_user
dn: cn=mike,ou=people,dc=example,dc=com
cn: mike
gidnumber: 10000
givenname: mike
homedirectory: /home/mike
loginshell: /bin/bash
mail: mike@example.com
objectclass: top
objectclass: posixAccount
objectclass: shadowAccount
objectclass: inetOrgPerson
objectclass: organizationalPerson
objectclass: person
sn: Joe
uid: mike
uidnumber: 5000
userpassword: {MD5}wb68DeX0CyENafzUADNn9A==
memberof: cn=harbor_users,ou=groups,dc=example,dc=com

View File

@ -132,3 +132,9 @@ Kill Local Docker Daemon
Process Should Be Stopped ${handle}
${rc}= Run And Return Rc kill -9 ${dockerd-pid}
Should Be Equal As Integers ${rc} 0
Docker Login Fail
[Arguments] ${ip} ${user} ${pwd}
Log To Console \nRunning docker login ${ip} ...
${rc} ${output}= Run And Return Rc And Output docker login -u ${user} -p ${pwd} ${ip}
Should Not Be Equal As Integers ${rc} 0

View File

@ -32,6 +32,8 @@ Init LDAP
Sleep 1
Input Text xpath=//*[@id="ldapBaseDN"] dc=example,dc=com
Sleep 1
Input Text xpath=//*[@id="ldapFilter"] (&(objectclass=inetorgperson)(memberof=cn=harbor_users,ou=groups,dc=example,dc=com))
Sleep 1
Input Text xpath=//*[@id="ldapUid"] cn
Sleep 1
Capture Page Screenshot

View File

@ -343,26 +343,31 @@ Test Case - Ldap Sign in and out
Switch To Configure
Init LDAP
Logout Harbor
Sign In Harbor ${HARBOR_URL} test 123456
Sign In Harbor ${HARBOR_URL} mike zhu88jie
Close Browser
Test Case - Ldap User Create Project
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} test 123456
Sign In Harbor ${HARBOR_URL} mike zhu88jie
Create An New Project project${d}
Close Browser
Test Case - Ldap User Push An Image
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} test 123456
Sign In Harbor ${HARBOR_URL} mike zhu88jie
Create An New Project project${d}
Push Image ${ip} test 123456 project${d} hello-world:latest
Push Image ${ip} mike zhu88jie project${d} hello-world:latest
Go Into Project project${d}
Wait Until Page Contains project${d}/hello-world
Close Browser
Test Case - Ldap User Can Not login
Docker Login Fail ${ip} test 123456
Test Case - Clean Harbor Images
Down Harbor