From e20cb51d6bd53375b441e5d4cf6c2eef7d8fc643 Mon Sep 17 00:00:00 2001 From: danfengliu Date: Fri, 17 Jul 2020 17:21:22 +0800 Subject: [PATCH] Fix issues in replication tests Signed-off-by: danfengliu --- tests/resources/Docker-Util.robot | 4 +-- .../resources/Harbor-Pages/Replication.robot | 11 ++++++- .../Group1-Nightly/Replication.robot | 30 +++++++++---------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/tests/resources/Docker-Util.robot b/tests/resources/Docker-Util.robot index 5c9d4d529..83eb2c513 100644 --- a/tests/resources/Docker-Util.robot +++ b/tests/resources/Docker-Util.robot @@ -181,7 +181,7 @@ Docker Push Index Docker Image Can Not Be Pulled [Arguments] ${image} :FOR ${idx} IN RANGE 0 30 - \ ${out} Run Keyword And Ignore Error Command Should be Failed docker pull ${image} + \ ${out}= Run Keyword And Ignore Error Command Should be Failed docker pull ${image} \ Exit For Loop If '${out[0]}'=='PASS' \ Sleep 3 Log To Console Cannot Pull Image From Docker - Pull Log: ${out[1]} @@ -191,7 +191,7 @@ Docker Image Can Be Pulled [Arguments] ${image} ${period}=60 ${times}=10 :For ${n} IN RANGE 1 ${times} \ Sleep ${period} - \ ${out} Run Keyword And Ignore Error Docker Pull ${image} + \ ${out}= Run Keyword And Ignore Error Docker Pull ${image} \ Log To Console Return value is ${out[0]} \ Exit For Loop If '${out[0]}'=='PASS' \ Sleep 5 diff --git a/tests/resources/Harbor-Pages/Replication.robot b/tests/resources/Harbor-Pages/Replication.robot index 2e21eba2e..95c3ed58c 100644 --- a/tests/resources/Harbor-Pages/Replication.robot +++ b/tests/resources/Harbor-Pages/Replication.robot @@ -225,7 +225,7 @@ Delete Endpoint Select Rule And Replicate [Arguments] ${rule_name} - Retry Double Keywords When Error Retry Element Click //hbr-list-replication-rule//clr-dg-cell[contains(.,'${rule_name}')] Wait Until Element Is Visible And Enabled ${replication_exec_id} + Select Rule ${rule_name} Retry Element Click ${replication_exec_id} Retry Double Keywords When Error Retry Element Click xpath=${dialog_replicate} Retry Wait Until Page Not Contains Element xpath=${dialog_replicate} @@ -257,3 +257,12 @@ Image Should Be Replicated To Project \ Sleep 5 Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot Should Be Equal As Strings '${out[0]}' 'PASS' + +Executions Result Count Should Be + [Arguments] ${expected_status} ${expected_trigger_type} ${expected_result_count} + Sleep 10 + ${count}= Get Element Count xpath=//clr-dg-row[contains(.,'${expected_status}') and contains(.,'${expected_trigger_type}')] + Capture Page Screenshot + Should Be Equal As Integers ${count} ${expected_result_count} + Capture Page Screenshot + diff --git a/tests/robot-cases/Group1-Nightly/Replication.robot b/tests/robot-cases/Group1-Nightly/Replication.robot index 8254d1a05..e4bb9b431 100644 --- a/tests/robot-cases/Group1-Nightly/Replication.robot +++ b/tests/robot-cases/Group1-Nightly/Replication.robot @@ -156,7 +156,7 @@ Test Case - Replication Of Pull Images from DockerHub To Self 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} pull danfengliu/* image e${d} project${d} + Create A Rule With Existing Endpoint rule${d} pull danfengliu/{cent*,mariadb} 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 @@ -274,7 +274,7 @@ Test Case - Replication Of Pull Images from Google-GCR To Self Image Should Be Replicated To Project project${d} tomcat Close Browser -Test Case - Replication Of Push Images to DockerHub +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 @@ -282,19 +282,19 @@ Test Case - Replication Of Push Images to DockerHub #login source Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Create An New Project And Go Into Project project${d} - ${image_with_tag}= Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} sha256=${sha256} tag_suffix=${true} Switch To Registries - Create A New Endpoint docker-hub e${d} https://hub.docker.com/ dockerhubtesterforharbor Aa12344321 Y + 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} dockerhubtesterforharbor mode=Event Based del_remote=${true} + Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} danfengliu mode=Event Based del_remote=${true} + ${image_with_tag}= Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} sha256=${sha256} tag_suffix=${true} Filter Replicatin Rule rule${d} - Select Rule And Replicate rule${d} - Sleep 20 - Docker Image Can Be Pulled dockerhubtesterforharbor/${image_with_tag} times=3 - Go Into Project project${d} - Delete Repo project${d} - Switch To Replication Manage - Filter Replicatin Rule rule${d} - Select Rule And Replicate rule${d} - Sleep 30 - Docker Image Can Not Be Pulled dockerhubtesterforharbor/${image_with_tag} \ No newline at end of file + Select Rule rule${d} + Docker Image Can Be Pulled danfengliu/${image_with_tag} 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_with_tag} + Switch To Replication Manage + Filter Replicatin Rule rule${d} + Select Rule rule${d} + Executions Result Count Should Be Succeeded event_based 2 \ No newline at end of file