Merge pull request #9069 from danfengliu/script-project-quotas-nightly-test-case

Script test case for project quotas
This commit is contained in:
jwangyangls 2019-09-19 10:27:22 +08:00 committed by GitHub
commit 5ffba4a6f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 239 additions and 59 deletions

View File

@ -33,15 +33,16 @@ Pull image
Should Not Contain ${output} No such image:
Push image
[Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${sha256}=${null} ${tag}=${null}
${full_image}= Set Variable If '${sha256}'=='${null}' ${image} ${image}@sha256:${sha256}
${image_with_tag}= Set Variable If '${tag}'=='${null}' ${image} ${image}:${sha256}
Log To Console \nRunning docker push ${full_image}...
Wait Unitl Command Success docker pull ${full_image}
[Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${sha256}=${null}
${image_with_sha256}= Set Variable If '${sha256}'=='${null}' ${image} ${image}@sha256:${sha256}
${image_with_tag}= Set Variable If '${sha256}'=='${null}' ${image} ${image}:${sha256}
Log To Console \nRunning docker push ${image}...
Wait Unitl Command Success docker pull ${image_with_sha256}
Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
Wait Unitl Command Success docker tag ${full_image} ${ip}/${project}/${image_with_tag}
Wait Unitl Command Success docker tag ${image_with_sha256} ${ip}/${project}/${image_with_tag}
Wait Unitl Command Success docker push ${ip}/${project}/${image_with_tag}
Wait Unitl Command Success docker logout ${ip}
Sleep 1
Push Image With Tag
#tag1 is tag of image on docker hub,default latest,use a version existing if you do not want to use latest
@ -70,12 +71,13 @@ Cannot Pull Unsigned Image
Should Contain ${output} The image is not signed in Notary
Cannot Push image
[Arguments] ${ip} ${user} ${pwd} ${project} ${image}
[Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${err_msg}=${null}
Log To Console \nRunning docker push ${image}...
Wait Unitl Command Success docker pull ${image}
Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
Wait Unitl Command Success docker tag ${image} ${ip}/${project}/${image}
Command Should be Failed docker push ${ip}/${project}/${image}
${output}= Command Should be Failed docker push ${ip}/${project}/${image}
Run Keyword If '${err_msg}' != '${null}' Should Contain ${output} ${err_msg}
Wait Unitl Command Success docker logout ${ip}
Wait Until Container Stops

View File

@ -17,7 +17,6 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***
Assign User Admin

View File

@ -17,7 +17,6 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***
Init LDAP
@ -94,7 +93,7 @@ Set Pro Create Admin Only
#set limit to admin only
Retry Element Click xpath=${configuration_xpath}
Sleep 2
Retry Element Click xpath=${system_config_xpath}
Retry Element Click xpath=${configuration_system_tabsheet_id}
Sleep 1
Retry Element Click xpath=//select[@id='proCreation']
Retry Element Click xpath=//select[@id='proCreation']//option[@value='adminonly']
@ -106,7 +105,7 @@ Set Pro Create Every One
Retry Element Click xpath=${configuration_xpath}
sleep 1
#set limit to Every One
Retry Element Click xpath=${system_config_xpath}
Retry Element Click xpath=${configuration_system_tabsheet_id}
Sleep 1
Retry Element Click xpath=//select[@id='proCreation']
Retry Element Click xpath=//select[@id='proCreation']//option[@value='everyone']
@ -150,7 +149,15 @@ Project Creation Should Not Display
Switch To System Settings
Sleep 1
Retry Element Click xpath=${configuration_xpath}
Retry Element Click xpath=${system_config_xpath}
Retry Element Click xpath=${configuration_system_tabsheet_id}
Sleep 1
Switch To Project Quotas
Sleep 1
Retry Element Click xpath=${configuration_xpath}
Retry Element Click xpath=${configuration_project_quotas_tabsheet_id}
Sleep 1
Modify Token Expiration
[Arguments] ${minutes}
Input Text xpath=//*[@id='tokenExpiration'] ${minutes}
@ -242,7 +249,12 @@ Switch To System Labels
Switch To Configuration System Setting
Sleep 1
Retry Element Click xpath=${configuration_xpath}
Retry Element Click xpath=${configuration_system_xpath}
Retry Element Click xpath=${configuration_system_tabsheet_id}
Switch To Configuration Project Quotas
Sleep 1
Retry Element Click xpath=${configuration_xpath}
Retry Element Click xpath=${configuration_project_quotas}
Create New Labels
[Arguments] ${labelname}
@ -312,4 +324,16 @@ Delete Top Item In System CVE Whitelist
[Arguments] ${count}=1
:FOR ${idx} IN RANGE 1 ${count}
\ Retry Element Click ${configuration_system_wl_delete_a_cve_id_icon}
Retry Element Click ${config_system_save_button_xpath}
Retry Element Click ${config_system_save_button_xpath}
Get Project Count Quota Text From Project Quotas List
[Arguments] ${project_name}
Switch To Project Quotas
${count_quota}= Get Text xpath=//project-quotas//clr-datagrid//clr-dg-row[contains(.,'${project_name}')]//clr-dg-cell[3]//label
[Return] ${count_quota}
Get Project Storage Quota Text From Project Quotas List
[Arguments] ${project_name}
Switch To Project Quotas
${storage_quota}= Get Text xpath=//project-quotas//clr-datagrid//clr-dg-row[contains(.,'${project_name}')]//clr-dg-cell[4]//label
[Return] ${storage_quota}

View File

@ -25,13 +25,13 @@ ${config_auth_save_button_xpath} //*[@id='config_auth_save']
${config_system_save_button_xpath} //*[@id='config_system_save']
${vulnerbility_save_button_xpath} //*[@id='config-save']
${configuration_xpath} //clr-main-container//clr-vertical-nav//a[contains(.,' Configuration ')]
${system_config_xpath} //*[@id='config-system']
${garbage_collection_xpath} //*[@id='config-gc']
${gc_log_xpath} //*[@id='gc-log']
${gc_config_page} //clr-vertical-nav-group-children/a[contains(.,'Garbage')]
${gc_now_xpath} //*[@id='gc']/gc-config//button[contains(.,'GC')]
${gc_log_details_xpath} //*[@id='clr-dg-row26']/clr-dg-cell[6]/a
${configuration_system_xpath} //*[@id='config-system']
${configuration_system_tabsheet_id} //*[@id='config-system']
${configuration_project_quotas_tabsheet_id} //*[@id='config-quotas']
${configuration_system_wl_add_btn} //*[@id='show-add-modal-button']
${configuration_system_wl_textarea} //*[@id='whitelist-textarea']
${configuration_system_wl_add_confirm_btn} //*[@id='add-to-system']

View File

@ -0,0 +1,32 @@
# Copyright Project Harbor Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot
*** Variables ***
*** Keywords ***
GC Now
[Arguments] ${harbor_url} ${login_user} ${login_pwd}
Switch To Garbage Collection
Click GC Now
Logout Harbor
Sleep 2
Sign In Harbor ${harbor_url} ${login_user} ${login_pwd}
Switch To Garbage Collection
Sleep 1
Switch To GC History
Retry Wait Until Page Contains Finished

View File

@ -17,7 +17,6 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***
Sign In Harbor

View File

@ -17,7 +17,6 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***

View File

@ -3,7 +3,6 @@
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} V1.1.1
*** Keywords ***

View File

@ -17,11 +17,11 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***
Go Into Project
[Arguments] ${project} ${has_image}=${true}
Sleep 2
Retry Wait Element ${search_input}
Input Text ${search_input} ${project}
Retry Wait Until Page Contains ${project}
@ -36,6 +36,7 @@ Go Into Project
\ Run Keyword If ${result} == ${true} Exit For Loop
\ Sleep 1
Should Be Equal ${result} ${true}
Sleep 1
Add User To Project Admin
[Arguments] ${project} ${user}

View File

@ -5,12 +5,10 @@ Resource ../../resources/Util.robot
Retag Image
[Arguments] ${tag} ${projectname} ${reponame} ${tagname}
Click Element xpath=//clr-dg-row[contains(.,'${tag}')]//label
Sleep 1
Click Element xpath=${retag_btn}
Sleep 1
Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//label
Retry Element Click xpath=${retag_btn}
#input necessary info
Input Text xpath=${project-name_xpath} ${projectname}
Input Text xpath=${repo-name_xpath} ${reponame}
Input Text xpath=${tag-name_xpath} ${tagname}
Click Element xpath=${confirm_btn}
Retry Text Input xpath=${project-name_xpath} ${projectname}
Retry Text Input xpath=${repo-name_xpath} ${reponame}
Retry Text Input xpath=${tag-name_xpath} ${tagname}
Retry Double Keywords When Error Retry Element Click ${confirm_btn} Retry Wait Until Page Not Contains Element ${confirm_btn}

View File

@ -17,19 +17,23 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***
Create An New Project
[Arguments] ${projectname} ${public}=false
[Arguments] ${projectname} ${public}=false ${count_quota}=${null} ${storage_quota}=${null} ${storage_quota_unit}=${null}
Navigate To Projects
Retry Button Click xpath=${create_project_button_xpath}
Log To Console Project Name: ${projectname}
Capture Page Screenshot
Retry Text Input xpath=${project_name_xpath} ${projectname}
${element_project_public}= Set Variable xpath=${project_public_xpath}
Run Keyword If '${public}' == 'true' Run Keywords Wait Until Element Is Visible And Enabled ${element_project_public} AND Click Element ${element_project_public}
Run Keyword If '${count_quota}'!='${null}' Input Count Quota ${count_quota}
Run Keyword If '${storage_quota}'!='${null}' Input Storage Quota ${storage_quota} ${storage_quota_unit}
Capture Page Screenshot
Retry Element Click ${create_project_OK_button_xpath}
Retry Wait Until Page Not Contains Element ${create_project_CANCEL_button_xpath}
Capture Page Screenshot
Go Into Project ${projectname} has_image=${false}
Create An New Project With New User
@ -189,15 +193,15 @@ Edit Repo Info
# Cancel input
Retry Element Click xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info-edit-textarea'] test_description_info
+ Retry Element Click xpath=//*[@id='edit-cancel']
+ Retry Element Click xpath=//clr-modal//button[contains(.,'CONFIRM')]
+ Retry Wait Until Page Contains Element //*[@id='no-editing']
Retry Element Click xpath=//*[@id='edit-cancel']
Retry Element Click xpath=//clr-modal//button[contains(.,'CONFIRM')]
Retry Wait Until Page Contains Element //*[@id='no-editing']
# Confirm input
Retry Element Click xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info-edit-textarea'] test_description_info
+ Retry Element Click xpath=//*[@id='edit-save']
Retry Element Click xpath=//*[@id='edit-save']
Retry Wait Until Page Contains test_description_info
Capture Page Screenshot RepoInfo.png
Capture Page Screenshot RepoInfo.png
Switch To Project Label
Retry Element Click xpath=//project-detail//a[contains(.,'Labels')]
@ -261,3 +265,20 @@ Get Statics Total Project
Convert To Integer ${totalproj}
[Return] ${totalproj}
Input Count Quota
[Arguments] ${text}
${element_xpath}= Set Variable ${project_add_count_quota_input_text_id}
Retry Clear Element Text ${element_xpath}
Retry Text Input ${element_xpath} ${text}
Input Storage Quota
[Arguments] ${text} ${unit}=${null}
${element_xpath}= Set Variable ${project_add_storage_quota_input_text_id}
Retry Clear Element Text ${element_xpath}
Retry Text Input ${element_xpath} ${text}
Run Keyword If '${unit}'!='${null}' Select Storage Quota unit ${unit}
Select Storage Quota unit
[Arguments] ${unit}
Select From List By Value ${project_add_storage_quota_unit_id} ${unit}

View File

@ -57,4 +57,7 @@ ${project_config_project_wl_radio_input} xpath=//clr-radio-wrapper//label[con
${project_config_project_wl_add_btn} xpath=//*[@id='show-add-modal']
${project_config_project_wl_add_confirm_btn} xpath=//*[@id='add-to-whitelist']
${project_config_save_btn} xpath=//hbr-project-policy-config//button[contains(.,'SAVE')]
${project_add_count_quota_input_text_id} xpath=//*[@id='create_project_count_limit']
${project_add_storage_quota_input_text_id} xpath=//*[@id='create_project_storage_limit']
${project_add_storage_quota_unit_id} xpath=//*[@id='create_project_storage_limit_unit']

View File

@ -17,7 +17,6 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***
Filter Replicatin Rule
@ -92,6 +91,7 @@ Create A Rule With Existing Endpoint
Run Keyword If '${mode}' == 'Scheduled' Log To Console Scheduled
#click save
Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button}
Sleep 2
Endpoint Is Unpingable
Retry Element Click ${ping_test_button}

View File

@ -17,7 +17,6 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***
Delete Success

View File

@ -17,7 +17,6 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***
Change Password

View File

@ -3,9 +3,9 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
${scan_now_button} //vulnerability-page//button[contains(.,'NOW')]
${vulnerability_page} //clr-vertical-nav-group-children/a[contains(.,'Vulnerability')]
*** Keywords ***
Disable Scan Schedule
Retry Double Keywords When Error Retry Element Click ${vulnerability_edit_btn} Retry Wait Until Page Not Contains Element ${vulnerability_edit_btn}

View File

@ -18,8 +18,6 @@ Library Selenium2Library
Library OperatingSystem
*** Variables ***
${HARBOR_VERSION} v1.1.1
${CLAIR_BUILDER} 1.6.0
*** Keywords ***
Install Harbor to Test Server

View File

@ -49,6 +49,7 @@ Resource Harbor-Pages/UserProfile.robot
Resource Harbor-Pages/UserProfile_Elements.robot
Resource Harbor-Pages/Administration-Users.robot
Resource Harbor-Pages/Administration-Users_Elements.robot
Resource Harbor-Pages/GC.robot
Resource Harbor-Pages/Configuration.robot
Resource Harbor-Pages/Configuration_Elements.robot
Resource Harbor-Pages/ToolKit.robot
@ -109,6 +110,11 @@ Retry Text Input
@{param} Create List ${element_xpath} ${text}
Retry Action Keyword Text Input @{param}
Retry Clear Element Text
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Clear Element Text @{param}
Retry Link Click
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}

View File

@ -133,7 +133,7 @@ Test Case - Project Level Image Serverity Policy
${sha256}= Set Variable 68b49a280d2fbe9330c0031970ebb72015e1272dfa25f0ed7557514f9e5ad7b7
${image}= Set Variable postgres
Create An New Project project${d}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} sha256=${sha256} tag=${sha256}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} sha256=${sha256}
Go Into Project project${d}
Go Into Repo ${image}
Scan Repo ${sha256} Succeed
@ -149,13 +149,12 @@ Test Case - Verfiy System Level CVE Whitelist
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${image}= Set Variable redis
#version redis:
${sha256}= Set Variable 9755880356c4ced4ff7745bafe620f0b63dd17747caedba72504ef7bac882089
${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256} tag=${sha256}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Go Into Project project${d}
Set Vulnerabilty Serverity 1
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
@ -184,7 +183,7 @@ Test Case - Verfiy Project Level CVE Whitelist
${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256} tag=${sha256}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d}
Set Vulnerabilty Serverity 1
@ -216,7 +215,7 @@ Test Case - Verfiy Project Level CVE Whitelist By Quick Way of Add System
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256} tag=${sha256}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Go Into Project project${d}
Set Vulnerabilty Serverity 1
Go Into Project project${d}

View File

@ -330,7 +330,6 @@ Test Case - Delete Multi Repo
Test Case - Delete Multi Tag
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user014 Test1@34
Create An New Project project${d}
Push Image With Tag ${ip} user014 Test1@34 project${d} redis 3.2.10-alpine 3.2.10-alpine
@ -449,3 +448,116 @@ Test Case - Retag A Image Tag
Page Should Contain Element xpath=${tag_value_xpath}
Close Browser
Test Case - Create An New Project With Quotas Set
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${count_quota}= Set Variable 1234
${storage_quota}= Set Variable 600
${storage_quota_unit}= Set Variable GB
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project${d} count_quota=${count_quota} storage_quota=${storage_quota} storage_quota_unit=${storage_quota_unit}
${count_quota_ret}= Get Project Count Quota Text From Project Quotas List project${d}
Should Be Equal As Strings ${count_quota_ret} 0 of ${count_quota}
${storage_quota_ret}= Get Project Storage Quota Text From Project Quotas List project${d}
Should Be Equal As Strings ${storage_quota_ret} 0Byte of ${storage_quota}${storage_quota_unit}
Close Browser
Test Case - Project Image And Chart Artifact Count Quotas Dispaly And Control
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${count_quota}= Set Variable 2
${storage_quota}= Set Variable 500
${storage_quota_unit}= Set Variable MB
${image}= Set Variable redis
${sha256}= Set Variable 9755880356c4ced4ff7745bafe620f0b63dd17747caedba72504ef7bac882089
${image_size}= Set Variable 34.14MB
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project${d} count_quota=${count_quota} storage_quota=${storage_quota} storage_quota_unit=${storage_quota_unit}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} sha256=${sha256}
${count_quota_ret}= Get Project Count Quota Text From Project Quotas List project${d}
Should Be Equal As Strings ${count_quota_ret} 1 of ${count_quota}
${storage_quota_ret}= Get Project Storage Quota Text From Project Quotas List project${d}
Should Be Equal As Strings ${storage_quota_ret} ${image_size} of ${storage_quota}${storage_quota_unit}
#Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} alpine
Go Into Project project${d}
Switch To Project Charts
Upload Chart files
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox err_msg=Quota exceeded when processing the request of adding 1 of count resource, which when updated to current usage of 2 will exceed the configured upper limit of 2
${count_quota_ret}= Get Project Count Quota Text From Project Quotas List project${d}
Should Be Equal As Strings ${count_quota_ret} 2 of ${count_quota}
Go Into Project project${d}
Delete Repo project${d}/${image}
${count_quota_ret}= Get Project Count Quota Text From Project Quotas List project${d}
Should Be Equal As Strings ${count_quota_ret} 1 of ${count_quota}
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox
Close Browser
Test Case - Project Storage Quotas Dispaly And Control
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${storage_quota}= Set Variable 330
${storage_quota_unit}= Set Variable MB
${image_a}= Set Variable redis
${image_b}= Set Variable logstash
${image_a_size}= Set Variable 34.14MB
${image_b_size}= Set Variable 321.03MB
${image_a_ver}= Set Variable 5.0
${image_b_ver}= Set Variable 6.8.3
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project${d} storage_quota=${storage_quota} storage_quota_unit=${storage_quota_unit}
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_b} tag=${image_b_ver} tag1=${image_b_ver}
${storage_quota_ret}= Get Project Storage Quota Text From Project Quotas List project${d}
Should Be Equal As Strings ${storage_quota_ret} ${image_b_size} of ${storage_quota}${storage_quota_unit}
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a}:${image_a_ver} err_msg=Quota exceeded when processing the request of adding 25.8 MiB of storage resource, which when updated to current usage of 329.3 MiB will exceed the configured upper limit of 330.0 MiB
Go Into Project project${d}
Delete Repo project${d}/${image_b}
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a} tag=${image_a_ver} tag1=${image_a_ver}
${storage_quota_ret}= Get Project Storage Quota Text From Project Quotas List project${d}
Should Be Equal As Strings ${storage_quota_ret} ${image_a_size} of ${storage_quota}${storage_quota_unit}
Close Browser
Test Case - Project Quotas Control Under Retag
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${count_quota}= Set Variable 1
${image_a}= Set Variable redis
${image_b}= Set Variable logstash
${image_a_ver}= Set Variable 5.0
${image_b_ver}= Set Variable 6.8.3
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project_a_${d}
Create An New Project project_b_${d} count_quota=${count_quota}
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project_a_${d} ${image_a} tag=${image_a_ver} tag1=${image_a_ver}
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project_a_${d} ${image_b} tag=${image_b_ver} tag1=${image_b_ver}
Go Into Project project_a_${d}
Go Into Repo project_a_${d}/${image_a}
Retag Image ${image_a_ver} project_b_${d} ${image_a} ${image_a_ver}
Retry Wait Element Not Visible ${repo_retag_confirm_dlg}
Go Into Project project_a_${d}
Go Into Repo project_a_${d}/${image_b}
Retag Image ${image_b_ver} project_b_${d} ${image_b} ${image_b_ver}
Retry Wait Element Not Visible ${repo_retag_confirm_dlg}
Sleep 2
Go Into Project project_b_${d}
Sleep 2
Capture Page Screenshot
Retry Wait Until Page Contains Element xpath=//clr-dg-cell[contains(.,'${image_a}')]/a
Retry Wait Until Page Not Contains Element xpath=//clr-dg-cell[contains(.,'${image_b}')]/a
Capture Page Screenshot
Close Browser
Test Case - Project Quotas Control Under GC
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${storage_quota}= Set Variable 200
${storage_quota_unit}= Set Variable MB
${image_a}= Set Variable logstash
${image_a_size}= Set Variable 321.03MB
${image_a_ver}= Set Variable 6.8.3
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project${d} storage_quota=${storage_quota} storage_quota_unit=${storage_quota_unit}
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a}:${image_a_ver} err_msg=Quota exceeded when processing the request of adding 82.5 MiB of storage resource, which when updated to current usage of 166.6 MiB will exceed the configured upper limit of 200.0 MiB
GC Now ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
${storage_quota_ret}= Get Project Storage Quota Text From Project Quotas List project${d}
Should Be Equal As Strings ${storage_quota_ret} 0Byte of ${storage_quota}${storage_quota_unit}
Close Browser

View File

@ -34,17 +34,7 @@ Test Case - Garbage Collection
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
Switch To GC History
Retry Wait Until Page Contains Finished
GC Now ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
${rc} ${output}= Run And Return Rc And Output curl -u ${HARBOR_ADMIN}:${HARBOR_PASSWORD} -i --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/system/gc/1/log"
Log To Console ${output}
Should Be Equal As Integers ${rc} 0