From 933dc91ba5470d0275f9ee2e175347c962d2f88b Mon Sep 17 00:00:00 2001 From: danfengliu Date: Fri, 27 Dec 2019 14:11:01 +0800 Subject: [PATCH] Notary test failed in Helm Pipeline In Helm pipeline, harbor access address is by domain name instead of IP, so cert directory should be created by domain name. Signed-off-by: danfengliu --- tests/resources/Harbor-Util.robot | 2 +- tests/resources/TestCaseBody.robot | 2 +- tests/robot-cases/Group0-Util/notary-push-image.sh | 7 +++++-- .../Group0-Util/notary-remove-image-signature.expect | 3 ++- tests/robot-cases/Group1-Nightly/Common.robot | 3 +++ 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/resources/Harbor-Util.robot b/tests/resources/Harbor-Util.robot index 67d60e07a..6c984ea80 100644 --- a/tests/resources/Harbor-Util.robot +++ b/tests/resources/Harbor-Util.robot @@ -101,7 +101,7 @@ Enable Notary Client Remove Notary Signature [Arguments] ${ip} ${image} - ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-remove-image-signature.expect ${ip} library ${image} + ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-remove-image-signature.expect ${ip} library ${image} ${notaryServerEndpoint} Log To Console ${output} Log ${output} Should Be Equal As Integers ${rc} 0 diff --git a/tests/resources/TestCaseBody.robot b/tests/resources/TestCaseBody.robot index 954bb813a..083ae4d13 100644 --- a/tests/resources/TestCaseBody.robot +++ b/tests/resources/TestCaseBody.robot @@ -105,7 +105,7 @@ Body Of Admin Push Signed Image Log ${output} Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world:latest - ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} library ${image} latest + ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} library ${image} latest ${notaryServerEndpoint} Log ${output} Should Be Equal As Integers ${rc} 0 diff --git a/tests/robot-cases/Group0-Util/notary-push-image.sh b/tests/robot-cases/Group0-Util/notary-push-image.sh index eb695b519..679746153 100755 --- a/tests/robot-cases/Group0-Util/notary-push-image.sh +++ b/tests/robot-cases/Group0-Util/notary-push-image.sh @@ -4,7 +4,7 @@ docker pull $3:$4 IP=$1 PASSHRASE='Harbor12345' - +notaryServerEndpoint=$5 echo $IP mkdir -p /etc/docker/certs.d/$IP/ @@ -13,8 +13,11 @@ mkdir -p ~/.docker/tls/$IP:4443/ cp /notary_ca.crt /etc/docker/certs.d/$IP/ cp /notary_ca.crt ~/.docker/tls/$IP:4443/ +mkdir -p ~/.docker/tls/$notaryServerEndpoint/ +cp /notary_ca.crt ~/.docker/tls/$notaryServerEndpoint/ + export DOCKER_CONTENT_TRUST=1 -export DOCKER_CONTENT_TRUST_SERVER=https://$IP:4443 +export DOCKER_CONTENT_TRUST_SERVER=https://$notaryServerEndpoint export NOTARY_ROOT_PASSPHRASE=$PASSHRASE export NOTARY_TARGETS_PASSPHRASE=$PASSHRASE diff --git a/tests/robot-cases/Group0-Util/notary-remove-image-signature.expect b/tests/robot-cases/Group0-Util/notary-remove-image-signature.expect index 18d10bd76..c98b9261e 100755 --- a/tests/robot-cases/Group0-Util/notary-remove-image-signature.expect +++ b/tests/robot-cases/Group0-Util/notary-remove-image-signature.expect @@ -3,9 +3,10 @@ set HOST [lindex $argv 0] set PROJECT [lindex $argv 1] set IMAGE [lindex $argv 2] +set notaryServerEndpoint [lindex $argv 3] set timeout 30 -spawn notary -s https://$HOST:4443 --tlscacert /notary_ca.crt -d /root/.docker/trust remove -p $HOST/$PROJECT/$IMAGE latest +spawn notary -s https://$notaryServerEndpoint --tlscacert /notary_ca.crt -d /root/.docker/trust remove -p $HOST/$PROJECT/$IMAGE latest expect { "Enter username:" {send "admin\r";exp_continue} diff --git a/tests/robot-cases/Group1-Nightly/Common.robot b/tests/robot-cases/Group1-Nightly/Common.robot index 350ed23a4..4461ea6ba 100644 --- a/tests/robot-cases/Group1-Nightly/Common.robot +++ b/tests/robot-cases/Group1-Nightly/Common.robot @@ -546,8 +546,11 @@ Test Case - Project Quotas Control Under GC ${image_a_size}= Set Variable 321.03MB ${image_a_ver}= Set Variable 6.8.3 Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Capture Page Screenshot Create An New Project project${d} storage_quota=${storage_quota} storage_quota_unit=${storage_quota_unit} + Capture Page Screenshot Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a}:${image_a_ver} err_msg=will exceed the configured upper limit of 200.0 MiB + Capture Page Screenshot GC Now ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} @{param} Create List project${d} Retry Keyword When Return Value Mismatch Get Project Storage Quota Text From Project Quotas List 0Byte of ${storage_quota}${storage_quota_unit} 60 @{param}