Migrate gitlab replication test to nightly

Add 2 gitlab pull/push replication test scripts in replication pipeline.

Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
danfengliu 2020-10-14 08:36:47 +00:00
parent ad7581d9b3
commit 3659abc62a
6 changed files with 44 additions and 65 deletions

View File

@ -128,7 +128,7 @@ class System(base.Base):
break
stats = client.scans_all_metrics_get()
print("Scan all status:", stats)
if stats.ongoing:
if stats.ongoing is False:
return
raise Exception("Error: Scan all job is timeout.")

View File

@ -20,11 +20,15 @@ Resource ../../resources/Util.robot
*** Keywords ***
Filter Replication Rule
[Arguments] ${ruleName}
[Arguments] ${ruleName} ${exist}=${true}
${rule_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${ruleName}')]
Retry Element Click ${filter_rules_btn}
Retry Clear Element Text ${filter_rules_input}
Retry Text Input ${filter_rules_input} ${ruleName}
Retry Wait Until Page Contains Element ${rule_name_element}
Run Keyword If ${exist}==${true} Retry Wait Until Page Contains Element ${rule_name_element}
... ELSE Retry Wait Element xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any replication rules!\")]
Filter Registry
[Arguments] ${registry_name}
@ -152,19 +156,6 @@ Rename Rule
Retry Text Input ${rule_name} ${newname}
Retry Element Click ${rule_save_button}
Delete Rule
[Arguments] ${rule}
Retry Element Click ${rule_filter_search}
Retry Text Input ${rule_filter_input} ${rule}
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Retry Element Click ${replication_rule_action}
Retry Element Click ${replication_rule_action_bar_delete}
Retry Wait Until Page Contains Element ${dialog_delete}
#change from click to mouse down and up
Mouse Down ${dialog_delete}
Mouse Up ${dialog_delete}
Sleep 2
Select Rule
[Arguments] ${rule}
Retry Double Keywords When Error Retry Element Click //clr-dg-row[contains(.,'${rule}')]/div/div[1]/div Retry Wait Element ${replication_rule_exec_id}
@ -184,40 +175,35 @@ Find Registry And Click Edit Button
Retry Select Object ${name}
Retry Element Click ${registry_edit_btn}
Find Rule And Click Edit Button
[Arguments] ${name}
Filter Object ${name}
Retry Select Object ${name}
Switch To Replication Manage Page
Switch To Registries
Switch To Replication Manage
Click Edit Button
Retry Element Click ${replication_rule_action}
Retry Element Click ${replication_rule_action_bar_edit}
Find Rule And Click Delete Button
[Arguments] ${name}
Filter Object ${name}
Retry Select Object ${name}
Click Delete Button
Retry Element Click ${replication_rule_action}
Retry Element Click ${replication_rule_action_bar_delete}
Switch To Replication Manage Page
Edit Replication Rule
[Arguments] ${name}
Switch To Registries
Switch To Replication Manage
Switch To Replication Manage Page
Filter Replication Rule ${name}
Select Rule ${name}
Click Edit Button
Retry Wait Until Page Contains Edit Replication Rule
Edit Replication Rule By Name
[Arguments] ${name}
Retry Double Keywords When Error Switch To Replication Manage Page "NULL" Find Rule And Click Edit Button ${name}
Delete Replication Rule By Name
[Arguments] ${name}
Switch To Registries
Switch To Replication Manage
Find Rule And Click Delete Button ${name}
Ensure Delete Replication Rule By Name
[Arguments] ${name}
Delete Replication Rule By Name ${name}
Retry Double Keywords When Error Retry Element Click ${delete_confirm_btn} Retry Wait Until Page Not Contains Element ${delete_confirm_btn}
Retry Wait Element xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any replication rules!\")]
Delete Replication Rule
[Arguments] ${name}
Switch To Replication Manage Page
Filter Replication Rule ${name}
Select Rule ${name}
Click Delete Button
Wait Until Page Contains Element ${dialog_delete}
Retry Double Keywords When Error Retry Element Click ${dialog_delete} Retry Wait Until Page Not Contains Element ${dialog_delete}
Filter Replication Rule ${name} exist=${false}
Rename Endpoint
[arguments] ${name} ${newname}
@ -242,17 +228,6 @@ Select Rule And Replicate
Retry Element Click ${replication_rule_exec_id}
Retry Double Keywords When Error Retry Element Click xpath=${dialog_replicate} Retry Wait Until Page Not Contains Element xpath=${dialog_replicate}
Delete Replication Rule
[Arguments] ${name}
Retry Element Click ${endpoint_filter_search}
Retry Text Input ${endpoint_filter_input} ${name}
#click checkbox before target endpoint
Retry Element Click //clr-dg-row[contains(.,'${name}')]//label
Retry Element Click ${replication_rule_action}
Retry Element Click ${replication_rule_action_bar_delete}
Wait Until Page Contains Element ${dialog_delete}
Retry Element Click ${dialog_delete}
Image Should Be Replicated To Project
[Arguments] ${project} ${image} ${period}=60 ${times}=3
FOR ${n} IN RANGE 0 ${times}

View File

@ -336,7 +336,7 @@ Verify Replicationrule
Init Chrome Driver
Log To Console -----replicationrule-----"${replicationrule}"------------
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Edit Replication Rule By Name ${replicationrule}
Edit Replication Rule ${replicationrule}
@{is_src_registry}= Get Value From Json ${json} $.replicationrule[?(@.rulename=${replicationrule})].is_src_registry
@{trigger_type}= Get Value From Json ${json} $.replicationrule[?(@.rulename=${replicationrule})].trigger_type
@{name_filters}= Get Value From Json ${json} $.replicationrule[?(@.rulename=${replicationrule})].name_filters

View File

@ -332,11 +332,13 @@ Body Of Replication Of Push Images to Registry Triggered By Event
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
${endpoint_body}= Fetch From Right ${endpoint} //
${dest_namespace}= Set Variable If '${provider}'=='gitlab' ${endpoint_body}/${dest_namespace} ${dest_namespace}
Run Keyword If '${provider}'=='docker-hub' or '${provider}'=='gitlab' 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}
Run Keyword If '${provider}'=='docker-hub' or '${provider}'=='gitlab' Docker Image Can Not Be Pulled ${dest_namespace}/${image}:${tag1}
Switch To Replication Manage
Filter Replication Rule rule${d}
Select Rule rule${d}
@ -354,10 +356,8 @@ Body Of Replication Of Pull Images from Registry To Self
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} pull ${project_name} image e${d} project${d}
Select Rule And Replicate rule${d}
#In docker-hub, under repository danfengliu, there're only 2 images: centos,mariadb.
Image Should Be Replicated To Project project${d} centos
Image Should Be Replicated To Project project${d} mariadb
FOR ${item} IN @{target_images}
Log To Console Check image replicated to Project project${d} ${item}
Image Should Be Replicated To Project project${d} ${item} times=2
END
Close Browser

View File

@ -88,7 +88,7 @@ Wait Until Element Is Visible And Enabled
Retry Action Keyword
[Arguments] ${keyword} @{param}
Retry Keyword N Times When Error 8 ${keyword} @{param}
Retry Keyword N Times When Error 3 ${keyword} @{param}
Retry Wait Element
[Arguments] ${element_xpath}
@ -149,6 +149,10 @@ Retry Wait Until Page Contains
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Contains @{param}
Retry Wait Until Page Does Not Contains
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Does Not Contain @{param}
Retry Wait Until Page Contains Element
[Arguments] ${element_xpath}

View File

@ -110,7 +110,7 @@ Test Case - Replication Rule Edit
Create A New Endpoint harbor ${endpoint2} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y
Switch To Replication Manage
Create A Rule With Existing Endpoint ${rule_name_old} pull nightly/a* image ${endpoint1} project${d}
Edit Replication Rule By Name ${rule_name_old}
Edit Replication Rule ${rule_name_old}
# Change rule-name, source-registry, filter, trigger-mode for edition verification
Clear Field Of Characters ${rule_name_input} 30
Retry Text Input ${rule_name_input} ${rule_name_new}
@ -123,7 +123,7 @@ Test Case - Replication Rule Edit
Retry Text Input ${targetCron_id} ${cron_str}
Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button}
# verify all items were changed as expected
Edit Replication Rule By Name ${rule_name_new}
Edit Replication Rule ${rule_name_new}
Retry Textfield Value Should Be ${rule_name_input} ${rule_name_new}
Retry List Selection Should Be ${src_registry_dropdown_list} ${endpoint2}-https://${ip}
Retry Textfield Value Should Be ${filter_name_id} project${d}
@ -132,7 +132,7 @@ Test Case - Replication Rule Edit
Retry List Selection Should Be ${rule_trigger_select} ${mode}
Retry Textfield Value Should Be ${targetCron_id} ${cron_str}
Retry Element Click ${rule_cancel_btn}
Ensure Delete Replication Rule By Name ${rule_name_new}
Delete Replication Rule ${rule_name_new}
Close Browser
Test Case - Replication Rule Delete
@ -145,7 +145,7 @@ Test Case - Replication Rule Delete
Create A New Endpoint harbor ${endpoint1} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y
Switch To Replication Manage
Create A Rule With Existing Endpoint ${rule_name} pull ${DOCKER_USER}/* image ${endpoint1} project${d}
Ensure Delete Replication Rule By Name ${rule_name}
Delete Replication Rule ${rule_name}
Close Browser
Test Case - Replication Of Pull Images from DockerHub To Self
@ -278,4 +278,4 @@ Test Case - Replication Of Pull Images from Gitlab To Self
Body Of Replication Of Pull Images from Registry To Self gitlab https://registry.gitlab.com ${gitlab_id} ${gitlab_key} dannylunsa/test_replication/{photon,alpine} @{target_images}
Test Case - Replication Of Push Images to Gitlab Triggered By Event
Body Of Replication Of Push Images to Registry Triggered By Event gitlab https://registry.gitlab.com ${gitlab_id} ${gitlab_key} bitsf/testci/replication-ci
Body Of Replication Of Push Images to Registry Triggered By Event gitlab https://registry.gitlab.com ${gitlab_id} ${gitlab_key} dannylunsa/test_replication