diff --git a/tests/resources/Harbor-Pages/Configuration.robot b/tests/resources/Harbor-Pages/Configuration.robot index dd5f7b2e9..5a67eae51 100644 --- a/tests/resources/Harbor-Pages/Configuration.robot +++ b/tests/resources/Harbor-Pages/Configuration.robot @@ -276,3 +276,19 @@ Delete A Label Capture Page Screenshot Click Element xpath=//clr-modal//div//button[contains(.,'DELETE')] Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${labelname}')]/../div/clr-icon[@shape="success-standard"] + +## Garbage Collection +Switch To Garbage Collection + Sleep 1 + Click Element xpath=${configuration_xpath} + Wait Until Page Contains Element ${garbage_collection_xpath} + Click Element xpath=${garbage_collection_xpath} + +Click GC Now + Sleep 1 + Click Element xpath=${gc_now_xpath} + Sleep 2 + +View GC Details + Click Element xpath=${gc_log_details_xpath} + Sleep 2 diff --git a/tests/resources/Harbor-Pages/Configuration_Elements.robot b/tests/resources/Harbor-Pages/Configuration_Elements.robot index e166dd6b4..b31ff8b28 100644 --- a/tests/resources/Harbor-Pages/Configuration_Elements.robot +++ b/tests/resources/Harbor-Pages/Configuration_Elements.robot @@ -21,4 +21,7 @@ ${self_reg_xpath} //input[@id="clr-checkbox-selfReg"] ${test_ldap_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/config/div/div/div/button[3] ${config_save_button_xpath} //config//div/button[contains(.,'SAVE')] ${configuration_xpath} //clr-vertical-nav-group-children/a[contains(.,'Configuration')] -${system_config_xpath} //*[@id="config-system"] \ No newline at end of file +${system_config_xpath} //*[@id="config-system"] +${garbage_collection_xpath} //*[@id="config-gc"] +${gc_now_xpath} //*[@id="gc"]/gc-config/button +${gc_log_details_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/config/div/div/section[6]/gc-config/clr-datagrid/div/div/div/clr-dg-table-wrapper/div[2]/clr-dg-row/div/clr-dg-cell[6]/a \ No newline at end of file diff --git a/tests/robot-cases/Group1-Nightly/Common.robot b/tests/robot-cases/Group1-Nightly/Common.robot index fda477b4a..12c97991f 100644 --- a/tests/robot-cases/Group1-Nightly/Common.robot +++ b/tests/robot-cases/Group1-Nightly/Common.robot @@ -37,6 +37,35 @@ Test Case - Vulnerability Data Not Ready Switch To Configure Go To Vulnerability Config Vulnerability Not Ready Config Hint + +Test Case - Garbage Collection + Init Chrome Driver + ${d}= Get Current Date result_format=%m%s + + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Create An New Project project${d} + Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world + Sleep 2 + Go Into Project project${d} + Delete Repo project${d} + + Switch To Garbage Collection + Click GC Now + Logout Harbor + Sleep 2 + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Switch To Garbage Collection + Sleep 1 + Wait Until Page Contains Finished + + ${rc} ${output}= Run And Return Rc And Output curl -u ${HARBOR_ADMIN}:${HARBOR_PASSWORD} -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/system/gc/2/log" + Log To Console ${output} + Should Be Equal As Integers ${rc} 0 + Should Contain ${output} 3 blobs eligible for deletion + Should Contain ${output} Deleting blob: + Should Contain ${output} success to run gc in job. + + Close Browser Test Case - Create An New Project Init Chrome Driver @@ -616,22 +645,6 @@ Test Case - Project Level Image Serverity Policy Cannot pull image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library haproxy Close Browser -Test Case - Admin Push Signed Image - Enable Notary Client - - ${rc} ${output}= Run And Return Rc And Output docker pull hello-world:latest - Log ${output} - - Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world:latest - ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${notaryServerEndpoint} - Log ${output} - Should Be Equal As Integers ${rc} 0 - - ${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/repositories/library/tomcat/signatures" - Log To Console ${output} - Should Be Equal As Integers ${rc} 0 - Should Contain ${output} sha256 - Test Case - List Helm Charts Init Chrome Driver ${d}= Get Current Date result_format=%m%s @@ -663,3 +676,19 @@ Test Case - List Helm Charts Go Back To Versions And Delete Close Browser + +Test Case - Admin Push Signed Image + Enable Notary Client + + ${rc} ${output}= Run And Return Rc And Output docker pull hello-world:latest + Log ${output} + + Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world:latest + ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${notaryServerEndpoint} + Log ${output} + Should Be Equal As Integers ${rc} 0 + + ${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/repositories/library/tomcat/signatures" + Log To Console ${output} + Should Be Equal As Integers ${rc} 0 + Should Contain ${output} sha256 \ No newline at end of file