Merge pull request #3484 from wy65701436/https-ci

Enable https support in CI testing
This commit is contained in:
Yan 2017-11-01 09:08:51 +08:00 committed by GitHub
commit 5ba414397d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 131 additions and 158 deletions

View File

@ -11,7 +11,7 @@ pipeline:
recursive: false
integration-test-on-pr:
image: vmware/harbor-e2e-engine:1.37
image: vmware/harbor-e2e-engine:1.38
pull: true
privileged: true
environment:
@ -35,7 +35,7 @@ pipeline:
status: success
bundle:
image: vmware/harbor-e2e-engine:1.37
image: vmware/harbor-e2e-engine:1.38
pull: true
privileged: true
environment:

View File

@ -1 +1 @@
eyJhbGciOiJIUzI1NiJ9.IyBIYXJib3IgZHJvbmUuCi0tLQp3b3Jrc3BhY2U6CiAgYmFzZTogL2Ryb25lCiAgcGF0aDogc3JjL2dpdGh1Yi5jb20vdm13YXJlL2hhcmJvcgoKcGlwZWxpbmU6CiAgY2xvbmU6CiAgICBpbWFnZTogcGx1Z2lucy9naXQKICAgIHRhZ3M6IHRydWUKICAgIHJlY3Vyc2l2ZTogZmFsc2UKCiAgaW50ZWdyYXRpb24tdGVzdC1vbi1wcjoKICAgIGltYWdlOiB2bXdhcmUvaGFyYm9yLWUyZS1lbmdpbmU6MS4zNwogICAgcHVsbDogdHJ1ZQogICAgcHJpdmlsZWdlZDogdHJ1ZQogICAgZW52aXJvbm1lbnQ6CiAgICAgIEJJTjogYmluCiAgICAgIEdPUEFUSDogL2Ryb25lCiAgICAgIFNIRUxMOiAvYmluL2Jhc2gKICAgICAgTE9HX1RFTVBfRElSOiBpbnN0YWxsLWxvZ3MKICAgICAgR0lUSFVCX0FVVE9NQVRJT05fQVBJX0tFWTogICR7R0lUSFVCX0FVVE9NQVRJT05fQVBJX0tFWX0KICAgICAgRFJPTkVfU0VSVkVSOiAgJHtEUk9ORV9TRVJWRVJ9CiAgICAgIERST05FX1RPS0VOOiAgJHtEUk9ORV9UT0tFTl9JTlRFfQogICAgICBIQVJCT1JfQ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ZpYy1wcm9kdWN0CiAgICB3aGVuOgogICAgICByZXBvOiB2bXdhcmUvaGFyYm9yCiAgICAgIGV2ZW50OiBbIHB1c2gsIHRhZyBdCiAgICAgIGJyYW5jaDogWyBtYXN0ZXIsIHJlbGVhc2UtKiwgcmVmcy90YWdzLyogXQogICAgICBzdGF0dXM6IHN1Y2Nlc3MK.zJ8m0va6puda1z8zxRk0rDeqPYZxfv7E8TRVI3d_1Sg

View File

@ -16,6 +16,17 @@
Documentation This resource contains keywords related to creating and using certificates. Requires scripts in infra/integration-image/scripts be available in PATH
*** Keywords ***
Generate Certificate Authority For Chrome
# add the ca to chrome trust list to enable https testing.
[Arguments] ${password}=%{HARBOR_PASSWORD}
Log To Console Generate Certificate Authority For Chrome
${rc} ${out}= Run And Return Rc And Output echo ${password} > password.ca
Log ${out}
Should Be Equal As Integers ${rc} 0
${rc} ${out}= Run And Return Rc And Output certutil -d sql:$HOME/.pki/nssdb -A -t TC -f password.ca -n "Harbor" -i ./harbor_ca.crt
Log ${out}
Should Be Equal As Integers ${rc} 0
Generate Certificate Authority
# Generates CA (private/ca.key.pem, certs/ca.cert.pem, certs/STARK_ENTERPRISES_ROOT_CA.crt) in OUT_DIR
[Arguments] ${CA_NAME}=STARK_ENTERPRISES_ROOT_CA ${OUT_DIR}=/root/ca
@ -24,7 +35,6 @@ Generate Certificate Authority
Log ${out}
Should Be Equal As Integers ${rc} 0
Generate Wildcard Server Certificate
# Generates key and signs with CA for *.DOMAIN (csr/*.DOMAIN.csr.pem,
# private/*.DOMAIN.key.pem, certs/*.DOMAIN.cert.pem) in OUT_DIR

View File

@ -40,11 +40,11 @@ Push image
Log To Console \nRunning docker push ${image}...
${rc}= Run And Return Rc docker pull ${image}
${rc} ${output}= Run And Return Rc And Output docker login -u ${user} -p ${pwd} ${ip}
Log To Console ${output}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc docker tag ${image} ${ip}/${project}/${image}
${rc} ${output}= Run And Return Rc And Output docker push ${ip}/${project}/${image}
Log To Console ${output}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc docker logout ${ip}
@ -53,11 +53,11 @@ Push Image With Tag
Log To Console \nRunning docker push ${image}...
${rc}= Run And Return Rc docker pull ${image}
${rc} ${output}= Run And Return Rc And Output docker login -u ${user} -p ${pwd} ${ip}
Log To Console ${output}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc docker tag ${image} ${tag}
${rc} ${output}= Run And Return Rc And Output docker push ${tag}
Log To Console ${output}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc docker logout ${ip}
@ -66,7 +66,7 @@ Cannot Pull image
${rc} ${output}= Run And Return Rc And Output docker login -u ${user} -p ${pwd} ${ip}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker pull ${ip}/${project}/${image}
Log To Console ${output}
Log ${output}
Should Not Be Equal As Integers ${rc} 0
Cannot Push image
@ -74,11 +74,11 @@ Cannot Push image
Log To Console \nRunning docker push ${image}...
${rc}= Run And Return Rc docker pull ${image}
${rc} ${output}= Run And Return Rc And Output docker login -u ${user} -p ${pwd} ${ip}
Log To Console ${output}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc docker tag ${image} ${ip}/${project}/${image}
${rc} ${output}= Run And Return Rc And Output docker push ${ip}/${project}/${image}
Log To Console ${output}
Log ${output}
Should Not Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc docker logout ${ip}

View File

@ -24,81 +24,53 @@ ${CLAIR_BUILDER} 1.2.7
*** Keywords ***
Install Harbor to Test Server
Log To Console \nStart Docker Daemon
Start Docker Daemon Locally
Sleep 5s
${rc} ${output}= Run And Return Rc And Output docker ps
Should Be Equal As Integers ${rc} 0
Log To Console \n${output}
Log To Console \nconfig harbor cfg
Run Keywords Config Harbor cfg
Run Keywords Prepare Cert
Log To Console \ncomplile and up harbor now
Run Keywords Compile and Up Harbor With Source Code
Log To Console \nStart Docker Daemon
Start Docker Daemon Locally
Sleep 5s
${rc} ${output}= Run And Return Rc And Output docker ps
Should Be Equal As Integers ${rc} 0
Log To Console \n${output}
Install Harbor With Notary to Test Server
Log To Console \nStart Docker Daemon
Start Docker Daemon Locally
Sleep 5s
${rc} ${output}= Run And Return Rc And Output docker ps
Should Be Equal As Integers ${rc} 0
Log To Console \n${output}
Log To Console \nconfig harbor cfg
Config Harbor cfg http_proxy=https
${rc} ${ip}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'
Log ${ip}
${rc}= Run And Return Rc sed "s/^IP=.*/IP=${ip}/g" -i ./tests/generateCerts.sh
Log ${rc}
${rc} ${output}= Run And Return Rc And Output ./tests/generateCerts.sh
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc mkdir -p /etc/docker/certs.d/${ip}/
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc mkdir -p ~/.docker/tls/${ip}:4443/
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output cp ./harbor_ca.crt /etc/docker/certs.d/${ip}/
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output cp ./harbor_ca.crt ~/.docker/tls/${ip}:4443/
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
Prepare Cert
Log To Console \ncomplile and up harbor now
Compile and Up Harbor With Source Code with_notary=true
Compile and Up Harbor With Source Code
${rc} ${output}= Run And Return Rc And Output docker ps
Should Be Equal As Integers ${rc} 0
Log To Console \n${output}
Generate Certificate Authority For Chrome
Up Harbor
[Arguments] ${with_notary}=true ${with_clair}=true
${rc} ${output}= Run And Return Rc And Output make start -e NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair}
Log To Console ${rc}
Should Be Equal As Integers ${rc} 0
[Arguments] ${with_notary}=true ${with_clair}=true
${rc} ${output}= Run And Return Rc And Output make start -e NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair}
Log ${rc}
Log ${output}
Should Be Equal As Integers ${rc} 0
Down Harbor
[Arguments] ${with_notary}=true ${with_clair}=true
${rc} ${output}= Run And Return Rc And Output echo "Y" | make down -e NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair}
Log To Console ${rc}
Should Be Equal As Integers ${rc} 0
[Arguments] ${with_notary}=true ${with_clair}=true
${rc} ${output}= Run And Return Rc And Output echo "Y" | make down -e NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair}
Log ${rc}
Should Be Equal As Integers ${rc} 0
Package Harbor Offline
[Arguments] ${golang_image}=golang:1.7.3 ${clarity_image}=vmware/harbor-clarity-ui-builder:${CLAIR_BUILDER} ${with_notary}=true ${with_clair}=true ${with_migrator}=true
Log To Console \nStart Docker Daemon
Start Docker Daemon Locally
${rc} ${output}= Run And Return Rc And Output make package_offline DEVFLAG=false GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} HTTPPROXY=
Log To Console ${rc}
Log ${output}
Should Be Equal As Integers ${rc} 0
[Arguments] ${golang_image}=golang:1.7.3 ${clarity_image}=vmware/harbor-clarity-ui-builder:${CLAIR_BUILDER} ${with_notary}=true ${with_clair}=true ${with_migrator}=true
Log To Console \nStart Docker Daemon
Start Docker Daemon Locally
${rc} ${output}= Run And Return Rc And Output make package_offline DEVFLAG=false GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} MIGRATORFLAG=${with_migrator} HTTPPROXY=
Log ${rc}
Log ${output}
Should Be Equal As Integers ${rc} 0
Switch To LDAP
Down Harbor with_notary=false
${rc} ${output}= Run And Return Rc And Output rm -rf /data
Log To Console ${rc}
Should Be Equal As Integers ${rc} 0
Config Harbor cfg auth=ldap_auth
Prepare with_notary=false
Up Harbor with_notary=false
Down Harbor
${rc} ${output}= Run And Return Rc And Output rm -rf /data
Log ${rc}
Should Be Equal As Integers ${rc} 0
Prepare Cert
Config Harbor cfg auth=ldap_auth http_proxy=https
Prepare
Up Harbor
${rc}= Run And Return Rc docker pull vmware/harbor-ldap-test:1.1.1
Log ${rc}
Should Be Equal As Integers ${rc} 0
@ -106,81 +78,73 @@ Switch To LDAP
Log ${rc}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker ps
Log ${output}
Should Be Equal As Integers ${rc} 0
Switch To Notary
Down Harbor with_notary=false
${rc} ${output}= Run And Return Rc And Output rm -rf /data
Log To Console ${rc}
${rc} ${output}= Run And Return Rc And Output rm -rf ~/.docker/
Log To Console ${rc}
Should Be Equal As Integers ${rc} 0
Config Harbor cfg http_proxy=https
${rc} ${ip}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'
Log ${ip}
${rc}= Run And Return Rc sed "s/^IP=.*/IP=${ip}/g" -i ./tests/generateCerts.sh
Generate Certificate Authority For Chrome
Enabe Notary Client
${rc} ${output}= Run And Return Rc And Output rm -rf ~/.docker/
Log ${rc}
${rc} ${output}= Run And Return Rc And Output ./tests/generateCerts.sh
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc mkdir -p /etc/docker/certs.d/${ip}/
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc mkdir -p ~/.docker/tls/${ip}:4443/
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output cp ./harbor_ca.crt /etc/docker/certs.d/${ip}/
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output cp ./harbor_ca.crt ~/.docker/tls/${ip}:4443/
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output ls -la /etc/docker/certs.d/${ip}/
Log To Console ${output}
${rc} ${output}= Run And Return Rc And Output ls -la ~/.docker/tls/${ip}:4443/
Log To Console ${output}
Prepare
Sleep 3s
Up Harbor
Sleep 30s
${rc} ${output}= Run And Return Rc And Output docker ps
Should Be Equal As Integers ${rc} 0
Log To Console \n${output}
Log ${ip}
${rc}= Run And Return Rc mkdir -p /etc/docker/certs.d/${ip}/
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc mkdir -p ~/.docker/tls/${ip}:4443/
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output cp ./harbor_ca.crt /etc/docker/certs.d/${ip}/
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output cp ./harbor_ca.crt ~/.docker/tls/${ip}:4443/
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output ls -la /etc/docker/certs.d/${ip}/
Log ${output}
${rc} ${output}= Run And Return Rc And Output ls -la ~/.docker/tls/${ip}:4443/
Log ${output}
Prepare
[Arguments] ${with_notary}=true ${with_clair}=true
${rc} ${output}= Run And Return Rc And Output make prepare -e NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair}
Log To Console ${rc}
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
[Arguments] ${with_notary}=true ${with_clair}=true
${rc} ${output}= Run And Return Rc And Output make prepare -e NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair}
Log ${rc}
Log ${output}
Should Be Equal As Integers ${rc} 0
Config Harbor cfg
# Will change the IP and Protocol in the harbor.cfg
[Arguments] ${http_proxy}=http ${auth}=db_auth
${rc} ${output}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'
Log ${output}
${rc}= Run And Return Rc sed "s/reg.mydomain.com/${output}/" -i ./make/harbor.cfg
${rc}= Run And Return Rc sed "s/^hostname = .*/hostname = ${output}/g" -i ./make/harbor.cfg
Log ${rc}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc sed "s/^ui_url_protocol = .*/ui_url_protocol = ${http_proxy}/g" -i ./make/harbor.cfg
Log ${rc}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc sed "s/^auth_mode = .*/auth_mode = ${auth}/g" -i ./make/harbor.cfg
${rc}= Run And Return Rc sed "s/^auth_mode = .*/auth_mode = ${auth}/g" -i ./make/harbor.cfg
Log ${rc}
Should Be Equal As Integers ${rc} 0
${out}= Run cat ./make/harbor.cfg
Log ${out}
Prepare Cert
# Will change the IP and Protocol in the harbor.cfg
${rc}= Run And Return Rc ./tests/generateCerts.sh
Log ${rc}
Should Be Equal As Integers ${rc} 0
${rc} ${ip}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'
Log ${ip}
${rc}= Run And Return Rc sed "s/^IP=.*/IP=${ip}/g" -i ./tests/generateCerts.sh
Log ${rc}
${out}= Run cat ./tests/generateCerts.sh
Log ${out}
${rc} ${output}= Run And Return Rc And Output ./tests/generateCerts.sh
Should Be Equal As Integers ${rc} 0
Compile and Up Harbor With Source Code
[Arguments] ${golang_image}=golang:1.7.3 ${clarity_image}=vmware/harbor-clarity-ui-builder:${CLAIR_BUILDER} ${with_notary}=false ${with_clair}=true
${rc} ${output}= Run And Return Rc And Output docker pull ${clarity_image}
[Arguments] ${golang_image}=golang:1.7.3 ${clarity_image}=vmware/harbor-clarity-ui-builder:${CLAIR_BUILDER} ${with_notary}=true ${with_clair}=true
${rc} ${output}= Run And Return Rc And Output docker pull ${clarity_image}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker pull ${golang_image}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker pull ${golang_image}
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output make install GOBUILDIMAGE=${golang_image} COMPILETAG=compile_golangimage CLARITYIMAGE=${clarity_image} NOTARYFLAG=${with_notary} CLAIRFLAG=${with_clair} HTTPPROXY=
Log ${output}
Should Be Equal As Integers ${rc} 0
Log ${output}
Should Be Equal As Integers ${rc} 0
Sleep 20

View File

@ -26,15 +26,13 @@ Start Selenium Standalone Server Locally
Init Chrome Driver
Run pkill chromedriver
Run pkill chrome
${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
Call Method ${chrome options} add_argument --headless
Call Method ${chrome options} add_argument --disable-gpu
Run pkill chrome
${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
Call Method ${chrome options} add_argument --headless
Call Method ${chrome options} add_argument --disable-gpu
Call Method ${chrome options} add_argument --start-maximized
Call Method ${chrome options} add_argument --ignore-certificate-errors
Call Method ${chrome options} add_argument --disable-web-security
Call Method ${chrome options} add_argument --allow-running-insecure-content
Call Method ${chrome options} add_argument --window-size\=1600,900
${chrome options.binary_location} Set Variable /usr/bin/google-chrome
Create Webdriver Chrome Chrome_headless chrome_options=${chrome options}
Sleep 5
Call Method ${chrome options} add_argument --no-sandbox
Call Method ${chrome options} add_argument --window-size\=1600,900
${chrome options.binary_location} Set Variable /usr/bin/google-chrome
Create Webdriver Chrome Chrome_headless chrome_options=${chrome options}
Sleep 5

View File

@ -19,7 +19,7 @@ Suite Setup Install Harbor to Test Server
Default Tags BAT
*** Variables ***
${HARBOR_URL} http://localhost
${HARBOR_URL} https://${ip}
*** Test Cases ***
Test Case - Create An New User
@ -84,7 +84,7 @@ Test Case - User View Logs
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true
Push image ${ip} tester${d} Test1@34 project${d} busybox:latest
Pull image ${ip} tester${d} Test1@34 project${d} busybox:latest
@ -227,7 +227,7 @@ Test Case - Scan A Tag
Summary Chart Should Display latest
Close Browser
Test Case-Manage Project Member
Test Case - Manage Project Member
Init Chrome Driver
${d}= Get current Date result_format=%m%s
@ -278,6 +278,26 @@ Test Case - Assign Sys Admin
Administration Tag Should Display
Close Browser
Test Case - Admin Push Signed Image
Enabe Notary Client
${rc} ${output}= Run And Return Rc And Output docker pull hello-world:latest
Log ${output}
Push image ${ip} %{HARBOR_ADMIN} %{HARBOR_PASSWORD} library hello-world:latest
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group9-Content-trust/notary-push-image.sh
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/repositories/library/tomcat/signatures"
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
#Should Contain ${output} sha256
Test Case - Admin Push Un-Signed Image
${rc} ${output}= Run And Return Rc And Output docker push ${ip}/library/hello-world:latest
Log To Console ${output}
Test Case - Ldap Sign in and out
Switch To LDAP
Init Chrome Driver
@ -305,25 +325,5 @@ Test Case - Ldap User Push An Image
Wait Until Page Contains project${d}/hello-world
Close Browser
Test Case - Admin Push Signed Image
Switch To Notary
${rc} ${output}= Run And Return Rc And Output docker pull hello-world:latest
Log To Console ${output}
Push image ${ip} %{HARBOR_ADMIN} %{HARBOR_PASSWORD} library hello-world:latest
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group9-Content-trust/notary-push-image.sh
Log To Console ${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/repositories/library/tomcat/signatures"
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
#Should Contain ${output} sha256
Test Case - Admin Push Un-Signed Image
${rc} ${output}= Run And Return Rc And Output docker push ${ip}/library/hello-world:latest
Log To Console ${output}
Test Case - Clean Harbor Images
Down Harbor with_notary=true
Down Harbor

View File

@ -19,10 +19,11 @@ Default Tags regression
*** Test Cases ***
Test Case - Admin Push Signed Image
Install Harbor With Notary to Test Server
Install Harbor to Test Server
Enabe Notary Client
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group9-Content-trust/notary-push-image.sh
Log To Console ${output}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${ip}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'