From fe043ec4a9f72f2809b7592a89eb6cb3008c988e Mon Sep 17 00:00:00 2001 From: stonezdj Date: Sat, 19 Oct 2024 19:03:05 +0800 Subject: [PATCH] update testcase to support Docker Image Can Be Pulled With Credential --- tests/resources/Docker-Util.robot | 14 ++++++++++++++ tests/resources/TestCaseBody.robot | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/resources/Docker-Util.robot b/tests/resources/Docker-Util.robot index 76fb89d8b18..2b447eb675f 100644 --- a/tests/resources/Docker-Util.robot +++ b/tests/resources/Docker-Util.robot @@ -274,3 +274,17 @@ Docker Image Can Be Pulled END Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot Should Be Equal As Strings '${out[0]}' 'PASS' + +Docker Image Can Be Pulled With Credential + [Arguments] ${server} ${username} ${password} ${image} ${period}=60 ${times}=2 + FOR ${n} IN RANGE 1 ${times} + Sleep ${period} + ${out}= Run Keyword And Ignore Error Docker Login ${server} ${username} ${password} + Log To Console Return value is ${out} + ${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 + END + Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot + Should Be Equal As Strings '${out[0]}' 'PASS' \ No newline at end of file diff --git a/tests/resources/TestCaseBody.robot b/tests/resources/TestCaseBody.robot index 50be8051b6f..6862b65bdbf 100644 --- a/tests/resources/TestCaseBody.robot +++ b/tests/resources/TestCaseBody.robot @@ -302,7 +302,8 @@ Body Of Replication Of Push Images to Registry Triggered By Event Select Rule rule${d} ${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=6 + Run Keyword If '${provider}'=='docker-hub' Docker Image Can Be Pulled ${dest_namespace}/${image}:${tag1} times=3 + Run Keyword If '${provider}'=='gitlab' Docker Image Can Be Pulled With Credential registry.gitlab.com ${username} ${pwd} ${dest_namespace}/${image}:${tag1} times=3 Executions Result Count Should Be Succeeded event_based 1 Go Into Project project${d} Delete Repo project${d} ${image}