mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
Add retries to test cases
Retry to solve the ecs environment s3aws Path not found issue Signed-off-by: Yang Jiao <jiaoya@vmware.com>
This commit is contained in:
parent
f178e2520e
commit
6dfdda7778
@ -22,11 +22,26 @@ def oras_push(harbor_server, user, password, project, repo, tag):
|
|||||||
fo = open(file_config, "w")
|
fo = open(file_config, "w")
|
||||||
fo.write( "{\"doc\":\"readme.md\"}" )
|
fo.write( "{\"doc\":\"readme.md\"}" )
|
||||||
fo.close()
|
fo.close()
|
||||||
|
|
||||||
|
exception = None
|
||||||
|
for _ in range(5):
|
||||||
|
exception = oras_push_cmd(harbor_server, project, repo, tag)
|
||||||
|
if exception == None:
|
||||||
|
break
|
||||||
|
if exception != None:
|
||||||
|
raise exception
|
||||||
|
return md5_artifact.split(' ')[0], md5_readme.split(' ')[0]
|
||||||
|
|
||||||
|
def oras_push_cmd(harbor_server, project, repo, tag):
|
||||||
|
try:
|
||||||
ret = base.run_command( [oras_cmd, "push", harbor_server + "/" + project + "/" + repo+":"+ tag,
|
ret = base.run_command( [oras_cmd, "push", harbor_server + "/" + project + "/" + repo+":"+ tag,
|
||||||
"--manifest-config", "config.json:application/vnd.acme.rocket.config.v1+json", \
|
"--manifest-config", "config.json:application/vnd.acme.rocket.config.v1+json", \
|
||||||
file_artifact+":application/vnd.acme.rocket.layer.v1+txt", \
|
file_artifact+":application/vnd.acme.rocket.layer.v1+txt", \
|
||||||
file_readme +":application/vnd.acme.rocket.docs.layer.v1+json"] )
|
file_readme +":application/vnd.acme.rocket.docs.layer.v1+json"] )
|
||||||
return md5_artifact.split(' ')[0], md5_readme.split(' ')[0]
|
return None
|
||||||
|
except Exception as e:
|
||||||
|
print("Run command error:", str(e))
|
||||||
|
return e
|
||||||
|
|
||||||
def oras_login(harbor_server, user, password):
|
def oras_login(harbor_server, user, password):
|
||||||
ret = base.run_command([oras_cmd, "login", "-u", user, "-p", password, harbor_server])
|
ret = base.run_command([oras_cmd, "login", "-u", user, "-p", password, harbor_server])
|
||||||
|
@ -20,10 +20,7 @@ Library Process
|
|||||||
*** Keywords ***
|
*** Keywords ***
|
||||||
CNAB Push Bundle
|
CNAB Push Bundle
|
||||||
[Arguments] ${ip} ${user} ${pwd} ${target} ${bundle_file} ${registry} ${namespace} ${index1} ${index2}
|
[Arguments] ${ip} ${user} ${pwd} ${target} ${bundle_file} ${registry} ${namespace} ${index1} ${index2}
|
||||||
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/cnab_push_bundle.sh ${ip} ${user} ${pwd} ${target} ${bundle_file} ${registry} ${namespace} ${index1} ${index2}
|
Wait Unitl Command Success ./tests/robot-cases/Group0-Util/cnab_push_bundle.sh ${ip} ${user} ${pwd} ${target} ${bundle_file} ${registry} ${namespace} ${index1} ${index2}
|
||||||
Log To Console ${output}
|
|
||||||
Log ${output}
|
|
||||||
Should Be Equal As Integers ${rc} 0
|
|
||||||
|
|
||||||
Prepare Cnab Push Test Data
|
Prepare Cnab Push Test Data
|
||||||
[Arguments] ${ip} ${user} ${pwd} ${project} ${index1_image1} ${index1_image2} ${index2_image1} ${index2_image2} ${image_tag}=latest
|
[Arguments] ${ip} ${user} ${pwd} ${project} ${index1_image1} ${index1_image2} ${index2_image1} ${index2_image2} ${image_tag}=latest
|
||||||
|
@ -38,9 +38,7 @@ Helm Repo Push
|
|||||||
|
|
||||||
Helm Chart Push
|
Helm Chart Push
|
||||||
[Arguments] ${ip} ${user} ${pwd} ${chart_file} ${archive} ${project} ${repo_name} ${verion}
|
[Arguments] ${ip} ${user} ${pwd} ${chart_file} ${archive} ${project} ${repo_name} ${verion}
|
||||||
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/helm_push_chart.sh ${ip} ${user} ${pwd} ${chart_file} ${archive} ${project} ${repo_name} ${verion}
|
Wait Unitl Command Success ./tests/robot-cases/Group0-Util/helm_push_chart.sh ${ip} ${user} ${pwd} ${chart_file} ${archive} ${project} ${repo_name} ${verion}
|
||||||
Log ${output}
|
|
||||||
Should Be Equal As Integers ${rc} 0
|
|
||||||
|
|
||||||
Helm3.7 Registry Login
|
Helm3.7 Registry Login
|
||||||
[Arguments] ${ip} ${user} ${password}
|
[Arguments] ${ip} ${user} ${password}
|
||||||
|
@ -174,10 +174,7 @@ Body Of Admin Push Signed Image
|
|||||||
${src_tag}= Set Variable latest
|
${src_tag}= Set Variable latest
|
||||||
${src_image}= Set Variable ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:${src_tag}
|
${src_image}= Set Variable ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:${src_tag}
|
||||||
Docker Pull ${src_image}
|
Docker Pull ${src_image}
|
||||||
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${project} ${image} ${tag} ${notaryServerEndpoint} ${src_image} ${user} ${pwd}
|
Wait Unitl Command Success ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${project} ${image} ${tag} ${notaryServerEndpoint} ${src_image} ${user} ${pwd}
|
||||||
|
|
||||||
Log ${output}
|
|
||||||
Should Be Equal As Integers ${rc} 0
|
|
||||||
|
|
||||||
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/projects/${project}/repositories/${image}/artifacts/${tag}?with_signature=true"
|
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/projects/${project}/repositories/${image}/artifacts/${tag}?with_signature=true"
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ Test Case - Push Helm Chart and Display
|
|||||||
Sign In Harbor ${HARBOR_URL} user010 Test1@34
|
Sign In Harbor ${HARBOR_URL} user010 Test1@34
|
||||||
Create An New Project And Go Into Project test${d}
|
Create An New Project And Go Into Project test${d}
|
||||||
|
|
||||||
Helm Chart Push ${ip} user010 Test1@34 ${chart_file} ${archive} test${d} ${repo_name} ${verion}
|
Retry Action Keyword Helm Chart Push ${ip} user010 Test1@34 ${chart_file} ${archive} test${d} ${repo_name} ${verion}
|
||||||
|
|
||||||
Go Into Project test${d}
|
Go Into Project test${d}
|
||||||
Wait Until Page Contains test${d}/${repo_name}
|
Wait Until Page Contains test${d}/${repo_name}
|
||||||
|
Loading…
Reference in New Issue
Block a user