mirror of
https://github.com/goharbor/harbor.git
synced 2025-03-11 22:20:00 +01:00
Fix nightly ldap test cases
1. Modify robot account test, checkout "Never Expired" button; 2. Modify OIDC get user API; 3. Modify verification for docker pull command; Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
parent
1bbd3585e5
commit
77e3b0d828
@ -83,6 +83,9 @@ class Artifact(base.Base, object):
|
||||
break
|
||||
artifact = self.get_reference_info(project_name, repo_name, reference, **kwargs)
|
||||
print "artifact", artifact
|
||||
print "artifact[0]", artifact[0]
|
||||
print "artifact[0].scan_overview", artifact[0].scan_overview
|
||||
print "artifact[0].scan_overview['application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0']", artifact[0].scan_overview['application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0']
|
||||
scan_status = artifact[0].scan_overview['application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0']["scan_status"]
|
||||
if scan_status == expected_scan_status:
|
||||
return
|
||||
|
@ -133,7 +133,7 @@ Docker Login Fail
|
||||
[Arguments] ${ip} ${user} ${pwd}
|
||||
Log To Console \nRunning docker login ${ip} ...
|
||||
${output}= Command Should be Failed docker login -u ${user} -p ${pwd} ${ip}
|
||||
Should Contain ${output} unauthorized: authentication required
|
||||
Should Contain ${output} 401 Unauthorized
|
||||
Should Not Contain ${output} 500 Internal Server Error
|
||||
|
||||
Docker Login
|
||||
|
@ -40,10 +40,10 @@ Sign In Harbor With OIDC User
|
||||
|
||||
Get Secrete By API
|
||||
[Arguments] ${url} ${username}=${OIDC_USERNAME}
|
||||
${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/users/search?username=${username}'
|
||||
${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/v2.0/users/search?username=${username}'
|
||||
${user_info}= Set Variable ${json[0]}
|
||||
${user_id}= Set Variable ${user_info["user_id"]}
|
||||
${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/users/${user_id}'
|
||||
${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/v2.0/users/${user_id}'
|
||||
${secret}= Set Variable ${json["oidc_user_meta"]["secret"]}
|
||||
[Return] ${secret}
|
||||
|
||||
|
@ -16,6 +16,7 @@ Create A Robot Account And Return Token
|
||||
Switch To Project Robot Account
|
||||
Retry Element Click ${project_robot_account_create_btn}
|
||||
Retry Text Input ${project_robot_account_create_name_input} ${robot_account_name}
|
||||
Retry Element Click ${project_robot_account_never_expired_chkbox}
|
||||
Retry Double Keywords When Error Retry Element Click ${project_robot_account_create_save_btn} Retry Wait Until Page Not Contains Element ${project_robot_account_create_save_btn}
|
||||
${token}= Get Value ${project_robot_account_token_input}
|
||||
[Return] ${token}
|
||||
|
@ -5,5 +5,6 @@ Documentation This resource provides any keywords related to the Harbor robot-a
|
||||
${project_robot_account_tabpage} xpath=//project-detail//a[contains(.,'Robot Accounts')]
|
||||
${project_robot_account_create_btn} xpath=//project-detail/app-robot-account//button
|
||||
${project_robot_account_token_input} xpath=//app-robot-account//hbr-copy-input//input
|
||||
${project_robot_account_never_expired_chkbox} xpath=//add-robot//clr-checkbox-wrapper/label[contains(.,'Never Expired')]
|
||||
${project_robot_account_create_name_input} //input[@id='robot_name']
|
||||
${project_robot_account_create_save_btn} //add-robot//button[contains(.,'SAVE')]
|
||||
|
@ -159,5 +159,5 @@ Wait for Harbor Ready
|
||||
Fail Harbor failed to come up properly!
|
||||
|
||||
Get Harbor Version
|
||||
${rc} ${output}= Run And Return Rc And Output curl -k -X GET --header 'Accept: application/json' 'https://${ip}/api/systeminfo'|grep -i harbor_version
|
||||
${rc} ${output}= Run And Return Rc And Output curl -k -X GET --header 'Accept: application/json' 'https://${ip}/api/v2.0/systeminfo'|grep -i harbor_version
|
||||
Log To Console ${output}
|
||||
|
@ -230,8 +230,9 @@ Retry Keyword When Error
|
||||
:For ${n} IN RANGE 1 6
|
||||
\ Log To Console Trying ${keyword} elements @{elements} ${n} times ...
|
||||
\ ${out} Run Keyword And Ignore Error ${keyword} @{elements}
|
||||
\ Log To Console Return value is ${out[0]}
|
||||
\ Exit For Loop If '${out[0]}'=='PASS'
|
||||
\ Log To Console Return value is ${out} and ${out[0]}
|
||||
\ Run Keyword If '${keyword}'=='Make Swagger Client' Exit For Loop If '${out[0]}'=='PASS' and '${out[1]}'=='0'
|
||||
\ ... ELSE Exit For Loop If '${out[0]}'=='PASS'
|
||||
\ Sleep 2
|
||||
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
|
||||
Should Be Equal As Strings '${out[0]}' 'PASS'
|
||||
|
@ -17,10 +17,6 @@ ${SERVER_API_ENDPOINT} ${SERVER_URL}/api
|
||||
&{SERVER_CONFIG} endpoint=${SERVER_API_ENDPOINT} verify_ssl=False
|
||||
|
||||
*** Test Cases ***
|
||||
Test Case - Scan Image
|
||||
Harbor API Test ./tests/apitests/python/test_scan_image_artifact.py
|
||||
Test Case - Scan All Images
|
||||
Harbor API Test ./tests/apitests/python/test_system_level_scan_all.py
|
||||
Test Case - Garbage Collection
|
||||
Harbor API Test ./tests/apitests/python/test_garbage_collection.py
|
||||
Test Case - Add Private Project Member and Check User Can See It
|
||||
@ -67,4 +63,7 @@ Test Case - Push Cnab Bundle
|
||||
Harbor API Test ./tests/apitests/python/test_push_cnab_bundle.py
|
||||
Test Case - Create/Delete tag
|
||||
Harbor API Test ./tests/apitests/python/test_create_delete_tag.py
|
||||
|
||||
Test Case - Scan Image
|
||||
Harbor API Test ./tests/apitests/python/test_scan_image_artifact.py
|
||||
Test Case - Scan All Images
|
||||
Harbor API Test ./tests/apitests/python/test_system_level_scan_all.py
|
||||
|
@ -116,4 +116,4 @@ Test Case - Ldap User Can Not login
|
||||
Test Case - Run LDAP Group Related API Test
|
||||
Harbor API Test ./tests/apitests/python/test_ldap_admin_role.py
|
||||
Harbor API Test ./tests/apitests/python/test_user_group.py
|
||||
Harbor API Test ./tests/apitests/python/test_assign_role_to_ldap_group.py
|
||||
Harbor API Test ./tests/apitests/python/test_assign_role_to_ldap_group.py
|
||||
|
Loading…
Reference in New Issue
Block a user