From 8947a62dc4d3eb43bd21e0980a282d0c8fa47422 Mon Sep 17 00:00:00 2001 From: danfengliu Date: Sun, 11 Jul 2021 17:54:55 +0800 Subject: [PATCH] Fix replication test issue in nightly Signed-off-by: danfengliu --- tests/resources/Harbor-Pages/Project.robot | 5 +++-- .../resources/Harbor-Pages/Replication.robot | 19 +++++++++---------- tests/resources/Harbor-Pages/Verify.robot | 3 ++- .../Group1-Nightly/Replication.robot | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/resources/Harbor-Pages/Project.robot b/tests/resources/Harbor-Pages/Project.robot index 9def41299..026a9c68d 100644 --- a/tests/resources/Harbor-Pages/Project.robot +++ b/tests/resources/Harbor-Pages/Project.robot @@ -254,7 +254,7 @@ Click Index Achieve Retry Element Click //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256') and contains(.,'${tag_name}')]//clr-dg-cell[1]//clr-tooltip//a Go Into Index And Contain Artifacts - [Arguments] ${tag_name} ${total_artifact_count}=3 ${archive_count}=0 + [Arguments] ${tag_name} ${total_artifact_count}=3 ${archive_count}=0 ${return_immediately}=${false} Retry Double Keywords When Error Click Index Achieve ${tag_name} Page Should Contain Element ${tag_table_column_os_arch} FOR ${n} IN RANGE 1 10 ${out1} Run Keyword And Ignore Error Page Should Contain Element ${artifact_rows} limit=${total_artifact_count} @@ -262,7 +262,8 @@ Go Into Index And Contain Artifacts Exit For Loop If '${out1[0]}'=='PASS' and '${out2[0]}'=='PASS' Sleep 3 END - Run Keyword If '${out1[0]}'=='FAIL' or '${out2[0]}'=='FAIL' Capture Page Screenshot + ${result}= Set Variable If '${out1[0]}'=='FAIL' or '${out2[0]}'=='FAIL' FAIL PASS + Return From Keyword If '${return_immediately}' == '${true}' ${result} Should Be Equal As Strings '${out1[0]}' 'PASS' Should Be Equal As Strings '${out2[0]}' 'PASS' diff --git a/tests/resources/Harbor-Pages/Replication.robot b/tests/resources/Harbor-Pages/Replication.robot index fc5192213..67616e5ca 100644 --- a/tests/resources/Harbor-Pages/Replication.robot +++ b/tests/resources/Harbor-Pages/Replication.robot @@ -243,17 +243,16 @@ Image Should Be Replicated To Project Switch To Project Repo ${out} Run Keyword And Ignore Error Retry Wait Until Page Contains ${project}/${image} Log To Console Return value is ${out[0]} - Exit For Loop If '${out[0]}'=='PASS' - Sleep 5 + Continue For Loop If '${out[0]}'=='FAIL' + Go Into Repo ${project}/${image} + ${size}= Run Keyword If '${tag}'!='${EMPTY}' and '${expected_image_size_in_regexp}'!='${null}' Get Text //clr-dg-row[contains(., '${tag}')]//clr-dg-cell[4]/div + Run Keyword If '${tag}'!='${EMPTY}' and '${expected_image_size_in_regexp}'!='${null}' Should Match Regexp '${size}' '${expected_image_size_in_regexp}' + Run Keyword If '${total_artifact_count}'!='${null}' Should Not Be Empty ${tag} + ${out} Run Keyword If '${total_artifact_count}'!='${null}' Go Into Index And Contain Artifacts ${tag} total_artifact_count=${total_artifact_count} archive_count=${archive_count} return_immediately=${true} + Log All out: ${out} + Exit For Loop If '${out}'=='PASS' + Sleep 30 END - Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot - Should Be Equal As Strings '${out[0]}' 'PASS' - Go Into Repo ${project}/${image} - ${size}= Run Keyword If '${tag}'!='${EMPTY}' and '${expected_image_size_in_regexp}'!='${null}' Get Text //clr-dg-row[contains(., '${tag}')]//clr-dg-cell[4]/div - Run Keyword If '${tag}'!='${EMPTY}' and '${expected_image_size_in_regexp}'!='${null}' Should Match Regexp '${size}' '${expected_image_size_in_regexp}' - Run Keyword If '${total_artifact_count}'!='${null}' Run Keywords - ... Should Not Be Empty ${tag} - ... AND Go Into Index And Contain Artifacts ${tag} total_artifact_count=${total_artifact_count} archive_count=${archive_count} Executions Result Count Should Be [Arguments] ${expected_status} ${expected_trigger_type} ${expected_result_count} diff --git a/tests/resources/Harbor-Pages/Verify.robot b/tests/resources/Harbor-Pages/Verify.robot index 6677e6693..b7a652337 100644 --- a/tests/resources/Harbor-Pages/Verify.robot +++ b/tests/resources/Harbor-Pages/Verify.robot @@ -565,6 +565,7 @@ Verify Quotas Display Log All storage_usage_unit:${storage_usage_unit} Log All storage_total_size:${storage_total_size} Log All storage_quota_ret:${storage_quota_ret} - Should Match Regexp ${storage_quota_ret} ${storage_usage_without_unit}(\\\.\\d{1,2})*${storage_usage_unit} of ${storage_total_size} + ${str_expected}= Replace String ${storage_usage_without_unit}(\\\.\\d{1,2})*${storage_usage_unit} of ${storage_total_size} B iB + Should Match Regexp ${storage_quota_ret} ${str_expected} END Close Browser diff --git a/tests/robot-cases/Group1-Nightly/Replication.robot b/tests/robot-cases/Group1-Nightly/Replication.robot index 29b7a9033..1d77ed7ce 100644 --- a/tests/robot-cases/Group1-Nightly/Replication.robot +++ b/tests/robot-cases/Group1-Nightly/Replication.robot @@ -241,7 +241,7 @@ Test Case - Replication Of Push Images from Self To Harbor By Push Event Create An New Project And Go Into Project project_dest${d} Push Special Image To Project project${d} ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${image} tags=@{tags} size=${image_size} # Use tag as identifier for this artifact - Image Should Be Replicated To Project project_dest${d} ${image} tag=${tag1} expected_image_size_in_regexp=4(\\\.\\d{1,2})*GB + Image Should Be Replicated To Project project_dest${d} ${image} tag=${tag1} expected_image_size_in_regexp=4(\\\.\\d{1,2})*GiB Close Browser Test Case - Replication Of Pull Images from AWS-ECR To Self