From 7d681c623bc20cf8e0a79cb2199922700d07b4e7 Mon Sep 17 00:00:00 2001 From: danfengliu Date: Fri, 30 Aug 2019 17:12:07 +0800 Subject: [PATCH] Add AWS-ECR and Google-GCR replication test into nighly tests. Signed-off-by: danfengliu --- .../resources/Harbor-Pages/Replication.robot | 18 +++++++- .../Harbor-Pages/Replication_Elements.robot | 3 ++ tests/resources/Util.robot | 4 +- .../Group1-Nightly/Replication.robot | 43 +++++++++++++++++++ 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/tests/resources/Harbor-Pages/Replication.robot b/tests/resources/Harbor-Pages/Replication.robot index 038a727b4..45d6fb3c2 100644 --- a/tests/resources/Harbor-Pages/Replication.robot +++ b/tests/resources/Harbor-Pages/Replication.robot @@ -20,6 +20,14 @@ Resource ../../resources/Util.robot ${HARBOR_VERSION} v1.1.1 *** Keywords *** +Filter Replicatin Rule + [Arguments] ${ruleName} + ${rule_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${ruleName}')] + Retry Element Click ${filter_rules_btn} + Retry Text Input ${filter_rules_input} ${ruleName} + Retry Wait Until Page Contains Element ${rule_name_element} + Capture Page Screenshot filter_replic_${ruleName}.png + Select Dest Registry [Arguments] ${endpoint} Retry Element Click ${dest_registry_dropdown_list} @@ -35,6 +43,11 @@ Select Trigger Retry Element Click ${rule_trigger_select} Retry Element Click ${rule_trigger_select}//option[contains(.,'${mode}')] +Select Destination URL + [Arguments] ${type} + Retry Element Click ${destination_url_xpath} + Retry Element Click ${destination_url_xpath}//option[contains(.,'${type}')] + Check New Rule UI Without Endpoint Retry Element Click ${new_replication-rule_button} Page Should Contain Please add an endpoint first @@ -49,8 +62,9 @@ Create A New Endpoint #input necessary info Select From List By Value ${provider_selector} ${provider} Retry Text Input xpath=${destination_name_xpath} ${name} - Run Keyword If '${provider}' != 'docker-hub' Run keyword Retry Text Input xpath=${destination_url_xpath} ${url} - Retry Text Input xpath=${destination_username_xpath} ${username} + Run Keyword If '${provider}' == 'harbor' Run keyword Retry Text Input xpath=${destination_url_xpath} ${url} + Run Keyword If '${provider}' == 'aws-ecr' or '${provider}' == 'google-gcr' Run keyword Select Destination URL ${url} + Run Keyword If '${provider}' != 'google-gcr' Retry Text Input xpath=${destination_username_xpath} ${username} Retry Text Input xpath=${destination_password_xpath} ${pwd} #cancel verify cert since we use a selfsigned cert Retry Element Click ${destination_insecure_xpath} diff --git a/tests/resources/Harbor-Pages/Replication_Elements.robot b/tests/resources/Harbor-Pages/Replication_Elements.robot index 591435b6a..9ffd76096 100644 --- a/tests/resources/Harbor-Pages/Replication_Elements.robot +++ b/tests/resources/Harbor-Pages/Replication_Elements.robot @@ -80,6 +80,9 @@ ${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 + diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index 4a35bddaf..3fae1a789 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -230,11 +230,11 @@ Retry Keyword When Error Retry Double Keywords When Error [Arguments] ${keyword1} ${element1} ${keyword2} ${element2} - :For ${n} IN RANGE 1 6 + :For ${n} IN RANGE 1 3 \ Log To Console Trying ${keyword1} and ${keyword2} ${n} times ... \ ${out1} Run Keyword And Ignore Error ${keyword1} ${element1} \ Capture Page Screenshot - \ Sleep 2 + \ Sleep 1 \ ${out2} Run Keyword And Ignore Error ${keyword2} ${element2} \ Capture Page Screenshot \ Log To Console Return value is ${out1[0]} ${out2[0]} diff --git a/tests/robot-cases/Group1-Nightly/Replication.robot b/tests/robot-cases/Group1-Nightly/Replication.robot index dc606c313..71fd24ffa 100644 --- a/tests/robot-cases/Group1-Nightly/Replication.robot +++ b/tests/robot-cases/Group1-Nightly/Replication.robot @@ -250,3 +250,46 @@ Test Case - Replication Of Push Images from Self To Harbor By Push Event Switch To Project Repo Retry Wait Until Page Contains project_dest${d}/centos Close Browser + +Test Case - Replication Of Pull Images from AWS-ECR To Harbor + 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 project${d} + Switch To Registries + Create A New Endpoint aws-ecr e${d} us-east-2 ${ecr_ac_id} ${ecr_ac_key} Y + Switch To Replication Manage + Create A Rule With Existing Endpoint rule${d} pull a/* image e${d} project${d} + Select Rule And Replicate rule${d} + Sleep 30 + Go Into Project project${d} + Switch To Project Repo + #In AWS-ECR, under repository a, there're only several images: httpd,tomcat. + Retry Wait Until Page Contains project${d}/httpd + Go Into Project project${d} + Switch To Project Repo + Retry Wait Until Page Contains project${d}/tomcat + Close Browser + +Test Case - Replication Of Pull Images from Google-GCR To Harbor + 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 project${d} + Switch To Registries + Create A New Endpoint google-gcr e${d} asia.gcr.io ${null} ${gcr_ac_key} Y + Switch To Replication Manage + Create A Rule With Existing Endpoint rule${d} pull eminent-nation-87317/* image e${d} project${d} + Filter Replicatin Rule rule${d} + Select Rule And Replicate rule${d} + Sleep 30 + Go Into Project project${d} + Switch To Project Repo + #In Google-GCR, under repository a, there're only several images: httpd,tomcat. + Retry Wait Until Page Contains project${d}/httpd + Go Into Project project${d} + Switch To Project Repo + Retry Wait Until Page Contains project${d}/tomcat + Close Browser