Merge pull request #16033 from YangJiao0817/add-replication-exclude-testcase

Add replication testcase for exclude and bandwidth
This commit is contained in:
Yang Jiao 2021-11-29 10:25:59 +08:00 committed by GitHub
commit 1d8719b7a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 86 additions and 1 deletions

View File

@ -49,6 +49,27 @@ Select Source Registry
Retry Element Click ${src_registry_dropdown_list} Retry Element Click ${src_registry_dropdown_list}
Retry Element Click ${src_registry_dropdown_list}//option[contains(.,'${endpoint}')] Retry Element Click ${src_registry_dropdown_list}//option[contains(.,'${endpoint}')]
Select Filter Tag Model
[Arguments] ${type}
Retry Element Click ${filter_tag_model_select}
Retry Element Click ${filter_tag_model_select}//option[contains(.,'${type}')]
Select Filter Label Model
[Arguments] ${type}
Retry Element Click ${filter_label_model_select}
Retry Element Click ${filter_label_model_select}//option[contains(.,'${type}')]
Select Filter Label
[Arguments] ${label}
Retry Element Click ${filter_label_button}
Retry Element Click //div[@class='filterSelect ng-star-inserted'][3]//label[contains(text(), '${label}')]
Retry Element Click ${filter_label_button}
Select Bandwidth Unit
[Arguments] ${unit}
Retry Element Click ${bandwidth_unit_select}
Retry Element Click ${bandwidth_unit_select}//option[contains(.,'${unit}')]
Select flattening Select flattening
[Arguments] ${type} [Arguments] ${type}
Retry Element Click ${flattening_select} Retry Element Click ${flattening_select}
@ -91,7 +112,8 @@ Create A New Endpoint
Create A Rule With Existing Endpoint Create A Rule With Existing Endpoint
[Arguments] ${name} ${replication_mode} ${filter_project_name} ${resource_type} ${endpoint} ${dest_namespace} [Arguments] ${name} ${replication_mode} ${filter_project_name} ${resource_type} ${endpoint} ${dest_namespace}
... ${mode}=Manual ${cron}="* */59 * * * *" ${del_remote}=${false} ${filter_tag}=${false} ${flattening}=Flatten 1 Level ... ${mode}=Manual ${cron}="* */59 * * * *" ${del_remote}=${false} ${filter_tag}=${false} ${filter_tag_model}=matching ${filter_label}=${false} ${filter_label_model}=matching
... ${flattening}=Flatten 1 Level ${bandwidth}=-1 ${bandwidth_unit}=Kbps
#click new #click new
Retry Element Click ${new_name_xpath} Retry Element Click ${new_name_xpath}
#input name #input name
@ -101,7 +123,10 @@ Create A Rule With Existing Endpoint
#set filter #set filter
Retry Text Input ${filter_name_id} ${filter_project_name} Retry Text Input ${filter_name_id} ${filter_project_name}
Run Keyword If '${filter_tag_model}' != 'matching' Select Filter Tag Model ${filter_tag_model}
Run Keyword If '${filter_tag}' != '${false}' Retry Text Input ${filter_tag_id} ${filter_tag} Run Keyword If '${filter_tag}' != '${false}' Retry Text Input ${filter_tag_id} ${filter_tag}
Run Keyword If '${filter_label_model}' != 'matching' Select Filter Label Model ${filter_label_model}
Run Keyword If '${filter_label}' != '${false}' Select Filter Label ${filter_label}
Run Keyword And Ignore Error Select From List By Value ${rule_resource_selector} ${resource_type} Run Keyword And Ignore Error Select From List By Value ${rule_resource_selector} ${resource_type}
Retry Text Input ${dest_namespace_xpath} ${dest_namespace} Retry Text Input ${dest_namespace_xpath} ${dest_namespace}
Select flattening ${flattening} Select flattening ${flattening}
@ -109,6 +134,10 @@ Create A Rule With Existing Endpoint
Select Trigger ${mode} Select Trigger ${mode}
Run Keyword If '${mode}' == 'Scheduled' Retry Text Input ${targetCron_id} ${cron} Run Keyword If '${mode}' == 'Scheduled' Retry Text Input ${targetCron_id} ${cron}
Run Keyword If '${mode}' == 'Event Based' and '${del_remote}' == '${true}' Retry Element Click ${del_remote_checkbox} Run Keyword If '${mode}' == 'Event Based' and '${del_remote}' == '${true}' Retry Element Click ${del_remote_checkbox}
#set bandwidth
Run Keyword If '${bandwidth}' != '-1' Retry Text Input ${bandwidth_input} ${bandwidth}
Run Keyword If '${bandwidth_unit}' != 'Kbps' Select Bandwidth Unit ${bandwidth_unit}
#click save #click save
Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button} Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button}
Sleep 2 Sleep 2

View File

@ -62,11 +62,16 @@ ${provider_selector} //*[@id='adapter']
${replication_mode_radio_push} //clr-main-container//hbr-create-edit-rule//label[contains(.,'Push-based')] ${replication_mode_radio_push} //clr-main-container//hbr-create-edit-rule//label[contains(.,'Push-based')]
${replication_mode_radio_pull} //clr-main-container//hbr-create-edit-rule//label[contains(.,'Pull-based')] ${replication_mode_radio_pull} //clr-main-container//hbr-create-edit-rule//label[contains(.,'Pull-based')]
${filter_name_id} //input[@id='filter_name'] ${filter_name_id} //input[@id='filter_name']
${filter_tag_model_select} //div[@class='filterSelect ng-star-inserted'][2]//select
${filter_tag_id} //input[@id='filter_tag'] ${filter_tag_id} //input[@id='filter_tag']
${filter_label_button} //div[@class='filterSelect ng-star-inserted'][3]//button
${filter_label_model_select} //div[@class='filterSelect ng-star-inserted'][3]//select
${rule_resource_selector} //*[@id='select_resource'] ${rule_resource_selector} //*[@id='select_resource']
${trigger_mode_selector} //*[@id='ruleTrigger'] ${trigger_mode_selector} //*[@id='ruleTrigger']
${dest_namespace_xpath} //*[@id='dest_namespace'] ${dest_namespace_xpath} //*[@id='dest_namespace']
${new_replication_rule_id} //*[@id='new_replication_rule_id'] ${new_replication_rule_id} //*[@id='new_replication_rule_id']
${bandwidth_input} //*[@id='speed']
${bandwidth_unit_select} //*[@id='speed_unit']
${registry_edit_btn} //button[contains(.,'Edit')] ${registry_edit_btn} //button[contains(.,'Edit')]
${registry_del_btn} //button[contains(.,'Delete')] ${registry_del_btn} //button[contains(.,'Delete')]

View File

@ -188,6 +188,57 @@ Test Case - Replication Of Push Images from Self To Harbor
Image Should Be Replicated To Project project_dest${d} busybox Image Should Be Replicated To Project project_dest${d} busybox
Close Browser Close Browser
Test Case - Replication Exclusion Mode And Set Bandwidth
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
# login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world:latest
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox:latest
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} alpine:3.10
# push mode
Switch To System Labels
Create New Labels bad_${d}
Go Into Project project${d}
Go Into Repo project${d}/busybox
Add Labels To Tag latest bad_${d}
Switch To Registries
Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} project_dest${d} filter_tag=3.10 filter_tag_model=excluding filter_label=bad_${d} filter_label_model=excluding bandwidth=100 bandwidth_unit=Kbps
# logout and login target
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project_dest${d}
# logout and login source
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Select Rule And Replicate rule${d}
Retry Wait Until Page Contains Succeeded
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Image Should Be Replicated To Project project_dest${d} hello-world period=0
# make sure the excluded image is not replication
Retry Wait Until Page Contains 1 - 1 of 1 items
# pull mode
Create An New Project And Go Into Project project${d}
Switch To System Labels
Create New Labels bad_${d}
Switch To Registries
Create A New Endpoint harbor e${d} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} pull project${d}/* image e${d} project${d} filter_tag=3.10 filter_tag_model=excluding filter_label=bad_${d} filter_label_model=excluding bandwidth=2 bandwidth_unit=Mbps
Select Rule And Replicate rule${d}
Retry Wait Until Page Contains Succeeded
Image Should Be Replicated To Project project${d} hello-world period=0
# make sure the excluded image is not replication
Retry Wait Until Page Contains 1 - 1 of 1 items
Close Browser
Test Case - Replication Of Push Chart from Self To Harbor Test Case - Replication Of Push Chart from Self To Harbor
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s