Skip to content

Commit

Permalink
[cherry-pick]Add replication by chunk testcase (goharbor#18903)
Browse files Browse the repository at this point in the history
Add replication by chunk testcase

Fix goharbor#17951

Signed-off-by: Yang Jiao <[email protected]>
  • Loading branch information
YangJiao0817 authored Jul 7, 2023
1 parent f8282a5 commit 4c335f7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
23 changes: 16 additions & 7 deletions tests/resources/Harbor-Pages/Replication.robot
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ Create A New Endpoint
Create A Rule With Existing Endpoint
[Arguments] ${name} ${replication_mode} ${filter_project_name} ${resource_type} ${endpoint} ${dest_namespace}
... ${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
... ${flattening}=Flatten 1 Level ${bandwidth}=-1 ${bandwidth_unit}=Kbps ${copy_by_chunk}=${false}
# Click new
Retry Double Keywords When Error Retry Element Click ${new_name_xpath} Wait Until Element Is Enabled ${rule_name}
#input name
# Input name
Retry Text Input ${rule_name} ${name}
Run Keyword If '${replication_mode}' == 'push' Run Keywords Retry Element Click ${replication_mode_radio_push} AND Select Dest Registry ${endpoint}
... ELSE Run Keywords Retry Element Click ${replication_mode_radio_pull} AND Select Source Registry ${endpoint}
#set filter
# Set filter
Retry Password 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}
Expand All @@ -129,14 +129,16 @@ Create A Rule With Existing Endpoint
Run Keyword And Ignore Error Select From List By Value ${rule_resource_selector} ${resource_type}
Retry Text Input ${dest_namespace_xpath} ${dest_namespace}
Select flattening ${flattening}
#set trigger
# Set trigger
Select Trigger ${mode}
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}
#set bandwidth
# 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
# Set copy by chunk
Run Keyword If '${copy_by_chunk}' == '${true}' Retry Element Click ${copy_by_chunk_checkbox}
# 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

Expand Down Expand Up @@ -293,3 +295,10 @@ Executions Result Count Should Be
Check Latest Replication Job Status
[Arguments] ${expected_status}
Retry Wait Element //hbr-replication//div[contains(@class,'datagrid')]//clr-dg-row[1][contains(.,'${expected_status}')]

Check Latest Replication Enabled Copy By Chunk
Retry Link Click //hbr-replication//div[contains(@class,'datagrid')]//clr-dg-row[1]//a
Retry Link Click //clr-dg-row[1]//a
Switch Window locator=NEW
Retry Wait Until Page Contains chunk completed
Switch Window locator=MAIN
1 change: 1 addition & 0 deletions tests/resources/Harbor-Pages/Replication_Elements.robot
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ ${del_remote_checkbox} //label[@for='ruleDeletion']
${filter_registry_btn} //hbr-filter
${filter_registry_input} //input[contains(@class,'filter-input')]
${flattening_select} //select[@id='dest_namespace_replace_count']
${copy_by_chunk_checkbox} //label[@for='by-chunk']
12 changes: 7 additions & 5 deletions tests/robot-cases/Group1-Nightly/Replication.robot
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,10 @@ Test Case - Robot Account Do Replication
Switch To Registries
Create A New Endpoint harbor e${d} https://${ip1} ${robot_account_name} ${robot_account_secret}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule_push_${d} push project${d}/* image e${d} project_dest${d}
Create A Rule With Existing Endpoint rule_push_${d} push project${d}/* image e${d} project_dest${d} copy_by_chunk=${true}
Select Rule And Replicate rule_push_${d}
Retry Wait Until Page Contains Succeeded
Check Latest Replication Job Status Succeeded
Check Latest Replication Enabled Copy By Chunk
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Image Should Be Replicated To Project project_dest${d} ${image1} period=0
Expand All @@ -406,10 +407,11 @@ Test Case - Robot Account Do Replication
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project_dest${d}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule_pull_${d} pull project_dest${d}/* image e${d} project_dest${d}
Create A Rule With Existing Endpoint rule_pull_${d} pull project_dest${d}/* image e${d} project_dest${d} copy_by_chunk=${true}
Select Rule And Replicate rule_pull_${d}
Retry Wait Until Page Contains Succeeded
Image Should Be Replicated To Project project_dest${d} ${image1} period=0
Check Latest Replication Job Status Succeeded
Check Latest Replication Enabled Copy By Chunk
Image Should Be Replicated To Project project_dest${d} ${image1}
Should Be Signed By Cosign ${tag1}
Image Should Be Replicated To Project project_dest${d} ${image2} period=0
Should Be Signed By Cosign ${tag2}
Expand Down

0 comments on commit 4c335f7

Please sign in to comment.