Add GCS&S3 push-based replicatiton tests

1. Add GCS push-based replicatiton tests;
   There is an issue against it, so it's commented out;
2. Add S3 push-based replicatiton tests;
3. Add filter registry keyword;

Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
danfengliu 2020-07-28 14:56:52 +08:00 committed by root
parent a2112bfa40
commit 8328e95b63
6 changed files with 283 additions and 268 deletions

View File

@ -62,7 +62,7 @@ RUN apt-get update && apt install libnss3-tools && \
RUN wget https://bootstrap.pypa.io/get-pip.py && \
python ./get-pip.py && \
pip install pyasn1 google-apitools==0.5.15 gsutil robotframework==3.0.4 robotframework-sshlibrary robotframework-httplibrary requests dbbot robotframework-selenium2library robotframework-pabot robotframework-JSONLibrary --upgrade
pip install pyasn1 google-apitools==0.5.15 gsutil robotframework==3.0.4 robotframework-sshlibrary robotframework-httplibrary requests dbbot robotframework-selenium2library==4.4.0 robotframework-pabot robotframework-JSONLibrary --upgrade
# Install docker, docker compose
RUN wget https://download.docker.com/linux/static/stable/x86_64/docker-18.06.3-ce.tgz && \

View File

@ -27,6 +27,14 @@ Filter Replication Rule
Retry Wait Until Page Contains Element ${rule_name_element}
Capture Page Screenshot filter_replic_${ruleName}.png
Filter Registry
[Arguments] ${registry_name}
${registry_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${registry_name}')]
Retry Element Click ${filter_registry_btn}
Retry Text Input ${filter_registry_input} ${ruleName}
Retry Wait Until Page Contains Element ${registry_name_element}
Capture Page Screenshot filter_repistry_${ruleName}.png
Select Dest Registry
[Arguments] ${endpoint}
Retry Element Click ${dest_registry_dropdown_list}
@ -68,7 +76,7 @@ Create A New Endpoint
#cancel verify cert since we use a selfsigned cert
Retry Element Click ${destination_insecure_xpath}
Run Keyword If '${save}' == 'Y' Run keyword Retry Double Keywords When Error Retry Element Click ${replication_save_xpath} Retry Wait Until Page Not Contains Element ${replication_save_xpath}
Run Keyword If '${save}' == 'Y' Run keyword Retry Wait Until Page Contains ${name}
Run Keyword If '${save}' == 'Y' Run keyword Filter Registry ${name}
Run Keyword If '${save}' == 'N' No Operation
Create A Rule With Existing Endpoint
@ -155,12 +163,6 @@ Delete Rule
Mouse Up ${dialog_delete}
Sleep 2
Filter Rule
[Arguments] ${rule}
Retry Element Click ${rule_filter_search}
Retry Text Input ${rule_filter_input} ${rule}
Sleep 1
Select Rule
[Arguments] ${rule}
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
@ -246,8 +248,8 @@ Delete Replication Rule
Retry Element Click ${dialog_delete}
Image Should Be Replicated To Project
[Arguments] ${project} ${image} ${period}=60 ${times}=10
:For ${n} IN RANGE 1 ${times}
[Arguments] ${project} ${image} ${period}=60 ${times}=3
:For ${n} IN RANGE 0 ${times}
\ Sleep ${period}
\ Go Into Project ${project}
\ Switch To Project Repo

View File

@ -23,7 +23,7 @@ ${policy_enable_checkbox} //input[@id='policy_enable']/../label
${policy_endpoint_checkbox} //input[@id='check_new']/../label
${destination_name_xpath} //*[@id='destination_name']
${destination_url_xpath} //*[@id='destination_url']
${destination_username_xpath} //*[@id='destination_access_key']
${destination_username_xpath} //*[@id='destination_access_key']
${destination_password_xpath} //*[@id='destination_password']
${replication_save_xpath} //button[contains(.,'OK')]
${replication_xpath} //clr-vertical-nav-group-children/a[contains(.,'Replication')]
@ -41,7 +41,7 @@ ${rule_trigger_select} //select[@id='ruleTrigger']
${schedule_type_select} //select[@name='scheduleType']
${schedule_day_select} //select[@name='scheduleDay']
${shcedule_time} //input[@type='time']
${destination_insecure_checkbox} //hbr-create-edit-endpoint/clr-modal//input[@id='destination_insecure']
${destination_insecure_checkbox} //hbr-create-edit-endpoint/clr-modal//input[@id='destination_insecure']
${ping_test_button} //button[contains(.,'Test')]
${nav_to_registries} //clr-vertical-nav//span[contains(.,'Registries')]
${nav_to_replications} //clr-vertical-nav//span[contains(.,'Replications')]
@ -59,30 +59,32 @@ ${dialog_delete} //clr-modal//button[contains(.,'DELETE')]
${dialog_replicate} //clr-modal//button[contains(.,'REPLICATE')]
${action_bar_replicate} //button[contains(.,'Replicate')]
${rule_save_button} //button[contains(.,'SAVE')]
${provider_selector} //*[@id='adapter']
${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')]
${filter_name_id} //input[@id='filter_name']
${filter_tag_id} //input[@id='filter_tag']
${rule_resource_selector} //*[@id='select_resource']
${trigger_mode_selector} //*[@id='ruleTrigger']
${dest_namespace_xpath} //*[@id='dest_namespace']
${new_replication_rule_id} //*[@id='new_replication_rule_id']
${edit_replication_rule_id} //*[@id='edit_replication_rule_id']
${delete_replication_rule_id} //*[@id='delete_replication_rule_id']
${replication_exec_id} //*[@id='replication_exe_id']
${replication_task_line_1} //clr-datagrid//clr-dg-row/div/div[2]//clr-checkbox-wrapper/label[1]
${is_overide_xpath} //label[contains(.,'Replace the destination resources if name exists')]
${enable_rule_xpath} //label[contains(.,'Enable rule')]
${targetCron_id} //*[@id='targetCron']
${rule_name_input} //*[@id='ruleName']
${src_registry_dropdown_list} //select[@id='src_registry_id']
${dest_registry_dropdown_list} //select[@id='dest_registry']
${rule_confirm_btn} //*[@id='ruleBtnOk']
${rule_cancel_btn} //*[@id='ruleBtnCancel']
${filter_rules_btn} //*[@id='filter-rules']
${provider_selector} //*[@id='adapter']
${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')]
${filter_name_id} //input[@id='filter_name']
${filter_tag_id} //input[@id='filter_tag']
${rule_resource_selector} //*[@id='select_resource']
${trigger_mode_selector} //*[@id='ruleTrigger']
${dest_namespace_xpath} //*[@id='dest_namespace']
${new_replication_rule_id} //*[@id='new_replication_rule_id']
${edit_replication_rule_id} //*[@id='edit_replication_rule_id']
${delete_replication_rule_id} //*[@id='delete_replication_rule_id']
${replication_exec_id} //*[@id='replication_exe_id']
${replication_task_line_1} //clr-datagrid//clr-dg-row/div/div[2]//clr-checkbox-wrapper/label[1]
${is_overide_xpath} //label[contains(.,'Replace the destination resources if name exists')]
${enable_rule_xpath} //label[contains(.,'Enable rule')]
${targetCron_id} //*[@id='targetCron']
${rule_name_input} //*[@id='ruleName']
${src_registry_dropdown_list} //select[@id='src_registry_id']
${dest_registry_dropdown_list} //select[@id='dest_registry']
${rule_confirm_btn} //*[@id='ruleBtnOk']
${rule_cancel_btn} //*[@id='ruleBtnCancel']
${filter_rules_btn} //*[@id='filter-rules']
${filter_rules_input} //*[@id='filter-rules']//input
${del_remote_checkbox} //label[@for='ruleDeletion']
${filter_registry_btn} //hbr-filter
${filter_registry_input} //input[contains(@class,'filter-input')]

View File

@ -186,7 +186,7 @@ Manage Project Member Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd} ${test_user1}=user005 ${test_user2}=user006 ${is_oidc_mode}=${false}
${d}= Get current Date result_format=%m%s
Create An New Project And Go Into Project project${d}
Push image ip=${ip} user=${sign_in_user} pwd=${sign_in_pwd} project=project${d} image=hello-world
Push image ${ip} ${sign_in_user} ${sign_in_pwd} project${d} hello-world
Logout Harbor
User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
@ -200,7 +200,7 @@ Manage Project Member Without Sign In Harbor
User Should Be Maintainer ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Manage Project Member ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Remove is_oidc_mode=${is_oidc_mode}
User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Push image ip=${ip} user=${sign_in_user} pwd=${sign_in_pwd} project=project${d} image=hello-world
Push image ${ip} ${sign_in_user} ${sign_in_pwd} project${d} hello-world
User Should Be Guest ${test_user2} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Helm CLI Push Without Sign In Harbor
@ -315,3 +315,31 @@ Body Of Verfiy Project Level CVE Allowlist By Quick Way of Add System
Add System CVE Allowlist to Project CVE Allowlist By Add System Button Click
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Close Browser
Body Of Replication Of Push Images to Registry Triggered By Event
[Arguments] ${provider} ${endpoint} ${username} ${pwd} ${dest_namespace}
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${sha256}= Set Variable 0e67625224c1da47cb3270e7a861a83e332f708d3d89dde0cbed432c94824d9a
${image}= Set Variable test_push_repli
${tag1}= Set Variable v1.1.0
@{tags} Create List ${tag1}
#login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d}
Switch To Registries
Create A New Endpoint ${provider} e${d} ${endpoint} ${username} ${pwd} Y
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} ${dest_namespace} mode=Event Based del_remote=${true}
Push Special Image To Project project${d} ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${image} tags=@{tags} size=12
Filter Replication Rule rule${d}
Select Rule rule${d}
Run Keyword If '${provider}'=='docker-hub' Docker Image Can Be Pulled ${dest_namespace}/${image}:${tag1} times=3
Executions Result Count Should Be Succeeded event_based 1
Go Into Project project${d}
Delete Repo project${d}
Run Keyword If '${provider}'=='docker-hub' Docker Image Can Not Be Pulled ${dest_namespace}/${image}:${tag1}
Switch To Replication Manage
Filter Replication Rule rule${d}
Select Rule rule${d}
Executions Result Count Should Be Succeeded event_based 2

View File

@ -71,7 +71,7 @@ Test Case - Generate User CLI Secret
Sign In Harbor With OIDC User ${HARBOR_URL}
Create An New Project And Go Into Project project${d}
${secret_old}= Get Secrete By API ${HARBOR_URL}
Push image ip=${ip} user=${OIDC_USERNAME} pwd=${secret_old} project=project${d} image=${image}
Push image ${ip} ${OIDC_USERNAME} ${secret_old} project${d} ${image}
${secret_new}= Generate And Return Secret ${HARBOR_URL}
Log To Console ${secret_old}
Log To Console ${secret_new}

View File

@ -275,28 +275,11 @@ Test Case - Replication Of Pull Images from Google-GCR To Self
Close Browser
Test Case - Replication Of Push Images to DockerHub Triggered By Event
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${sha256}= Set Variable 0e67625224c1da47cb3270e7a861a83e332f708d3d89dde0cbed432c94824d9a
${image}= Set Variable test_push_repli
${tag1}= Set Variable v1.1.0
@{tags} Create List ${tag1}
#login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d}
Switch To Registries
Create A New Endpoint docker-hub e${d} https://hub.docker.com/ danfengliu Aa123456 Y
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} danfengliu mode=Event Based del_remote=${true}
Push Special Image To Project project${d} ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${image} tags=@{tags} size=12
Filter Replication Rule rule${d}
Select Rule rule${d}
Docker Image Can Be Pulled danfengliu/${image}:${tag1} times=3
Executions Result Count Should Be Succeeded event_based 1
Go Into Project project${d}
Delete Repo project${d}
Docker Image Can Not Be Pulled danfengliu/${image}:${tag1}
Switch To Replication Manage
Filter Replication Rule rule${d}
Select Rule rule${d}
Executions Result Count Should Be Succeeded event_based 2
Body Of Replication Of Push Images to Registry Triggered By Event docker-hub https://hub.docker.com/ danfengliu Aa123456 danfengliu
#Due to issue of delete event replication
#Test Case - Replication Of Push Images to Google-GCR Triggered By Event
#Body Of Replication Of Push Images to Registry Triggered By Event google-gcr gcr.io ${null} ${gcr_ac_key} eminent-nation-87317/harbor-nightly-replication
Test Case - Replication Of Push Images to AWS-ECR Triggered By Event
Body Of Replication Of Push Images to Registry Triggered By Event aws-ecr us-east-2 ${ecr_ac_id} ${ecr_ac_key} harbor-nightly-replication