diff --git a/tests/apitests/python/library/base.py b/tests/apitests/python/library/base.py index 5688aefac..feaa6169a 100644 --- a/tests/apitests/python/library/base.py +++ b/tests/apitests/python/library/base.py @@ -92,6 +92,32 @@ def _get_string_from_unicode(udata): result = result + tmp.strip('\n\r\t') return result +def restart_process(process): + if process == "dockerd": + full_process_name = process + elif process == "containerd": + full_process_name = "/usr/local/bin/containerd" + else: + raise Exception("Please input dockerd or containerd for process retarting.") + run_command_with_popen("ps aux |grep " + full_process_name) + for i in range(10): + pid = run_command_with_popen(["pidof " + full_process_name]) + if pid in [None, ""]: + break + run_command_with_popen(["kill " + str(pid)]) + time.sleep(3) + + run_command_with_popen("ps aux |grep " + full_process_name) + run_command_with_popen("rm -rf /var/lib/" + process + "/*") + run_command_with_popen(full_process_name + " > ./daemon-local.log 2>&1 &") + time.sleep(3) + pid = run_command_with_popen(["pidof " + full_process_name]) + if pid in [None, ""]: + raise Exception("Failed to start process {}.".format(full_process_name)) + run_command_with_popen("ps aux |grep " + full_process_name) + + + def run_command_with_popen(command): print("Command: ", subprocess.list2cmdline(command)) @@ -100,11 +126,14 @@ def run_command_with_popen(command): stdout=subprocess.PIPE,stderr=subprocess.STDOUT) output, errors = proc.communicate() except Exception as e: - print("Error:", e) + print("Run command caught exception:", e) + output = None else: print(proc.returncode, errors, output) finally: proc.stdout.close() + print("output: ", output) + return output def run_command(command, expected_error_message = None): print("Command: ", subprocess.list2cmdline(command)) diff --git a/tests/apitests/python/test_project_level_policy_content_trust.py b/tests/apitests/python/test_project_level_policy_content_trust.py index 6c8d01baa..88eea0fbe 100644 --- a/tests/apitests/python/test_project_level_policy_content_trust.py +++ b/tests/apitests/python/test_project_level_policy_content_trust.py @@ -1,6 +1,7 @@ from __future__ import absolute_import import unittest +import time from testutils import ADMIN_CLIENT, suppress_urllib3_warning from testutils import harbor_server @@ -12,6 +13,8 @@ from library.repository import Repository from library.repository import push_self_build_image_to_project from library.repository import pull_harbor_image from library.docker_api import docker_image_clean_all +from library.base import restart_process + class TestProjects(unittest.TestCase): @suppress_urllib3_warning def setUp(self): @@ -78,6 +81,9 @@ class TestProjects(unittest.TestCase): #7. Pull image(IA) failed and the reason is "The image is not signed in Notary". docker_image_clean_all() + restart_process("containerd") + restart_process("dockerd") + time.sleep(30) pull_harbor_image(harbor_server, ADMIN_CLIENT["username"], ADMIN_CLIENT["password"], TestProjects.repo_name, tag, expected_error_message = "The image is not signed in Notary") if __name__ == '__main__': diff --git a/tests/apitests/python/test_retention.py b/tests/apitests/python/test_retention.py index f064404f8..dd53ee33a 100644 --- a/tests/apitests/python/test_retention.py +++ b/tests/apitests/python/test_retention.py @@ -44,12 +44,12 @@ class TestProjects(unittest.TestCase): @unittest.skipIf(TEARDOWN == False, "Test data won't be erased.") def tearDown(self): - # TODO delete_repository will fail when no tags left anymore - # resp=self.repo.list_repositories(TestProjects.project_src_repo_id, **TestProjects.USER_RA_CLIENT) - # for repo in resp: - # self.repo.delete_repository(repo.name, **TestProjects.USER_RA_CLIENT) - # self.project.delete_project(TestProjects.project_src_repo_id, **TestProjects.USER_RA_CLIENT) - # self.user.delete_user(TestProjects.user_ra_id, **ADMIN_CLIENT) + #TODO delete_repository will fail when no tags left anymore + resp=self.repo.list_repositories(TestProjects.project_src_repo_name, **TestProjects.USER_RA_CLIENT) + for repo in resp: + self.repo.delete_repository(TestProjects.project_src_repo_name, repo.name.split('/')[1], **TestProjects.USER_RA_CLIENT) + self.project.delete_project(TestProjects.project_src_repo_id, **TestProjects.USER_RA_CLIENT) + self.user.delete_user(TestProjects.user_ra_id, **ADMIN_CLIENT) print("Case completed") def testTagRetention(self): diff --git a/tests/ci/api_common_install.sh b/tests/ci/api_common_install.sh index f1e80a0da..9750646f7 100755 --- a/tests/ci/api_common_install.sh +++ b/tests/ci/api_common_install.sh @@ -18,6 +18,33 @@ cat /proc/version sudo -H pip install --ignore-installed urllib3 chardet requests --upgrade python --version +#---------------Set DNS for docker v20-------------------# +# In docker v20, it fixed an issue named "Wrong resolv.conf +# used on Ubuntu 19", this fix caused DNS solve problem +# in container. So the current work round is read DNS server +# from system and set the value in /etc/docker/daemon.json. + +ip addr +dns_ip=$(netplan ip leases eth0 | grep -i dns | awk -F = '{print $2}') +dns_ip_list=$(echo $dns_ip | tr " " "\n") +dns_cfg="" +for ip in $dns_ip_list +do + dns_cfg="$dns_cfg,\"$ip\"" +done + +cat /etc/docker/daemon.json + +if [ $(cat /etc/docker/daemon.json |grep \"dns\" |wc -l) -eq 0 ];then + sudo sed "s/}/,\n \"dns\": [${dns_cfg:1}]\n}/" -i /etc/docker/daemon.json +fi + +cat /etc/docker/daemon.json +sudo systemctl daemon-reload +sudo systemctl restart docker +sudo systemctl status docker +#--------------------------------------------------------# + sudo ./tests/hostcfg.sh if [ "$2" = 'LDAP' ]; then diff --git a/tests/ci/api_run.sh b/tests/ci/api_run.sh index f1d04aaa7..f7bc821e4 100755 --- a/tests/ci/api_run.sh +++ b/tests/ci/api_run.sh @@ -18,7 +18,7 @@ harbor_logs_bucket="harbor-ci-logs" #echo "content_language = en" >> $botofile #echo "default_project_id = $GS_PROJECT_ID" >> $botofile DIR="$(cd "$(dirname "$0")" && pwd)" -E2E_IMAGE="goharbor/harbor-e2e-engine:2.6.2" +E2E_IMAGE="goharbor/harbor-e2e-engine:2.6.3" # GS util function uploader { diff --git a/tests/e2e-image/Dockerfile b/tests/e2e-image/Dockerfile index dc50cb8a1..521a6355d 100644 --- a/tests/e2e-image/Dockerfile +++ b/tests/e2e-image/Dockerfile @@ -1,11 +1,14 @@ FROM ubuntu:18.04 ENV LANG C.UTF-8 # V 2.0 -# V 2.0.1: upgrade docker to version 19.03.12. +# V 2.0.1: Upgrade docker to version 19.03.12. # V 2.5 Add support for e2e py-test (especially containerd). -# V 2.6 docker 19.03.12. -# V 2.6.1 upgrade containerd(ctr) to v1.4.3, docker 20.10.3. -# V 2.6.2 package busybox into E2E image. +# V 2.6 Upgrade docker 19.03.12. +# V 2.6.1 Upgrade containerd(ctr) to v1.4.3, docker 20.10.3. +# V 2.6.2 Package busybox into E2E image. +# V 2.6.3 a. Swith python version from 3.7 to 3.6; +# b. Upgrade and fix cnab-to-oci build issue; +# c. Install hurry.filesize tool in python. RUN apt-get update && apt-get install -y --no-install-recommends wget curl gnupg2 RUN apt-get install libseccomp2 @@ -66,8 +69,8 @@ RUN apt-get update && apt-get install -y software-properties-common && \ RUN apt-get update && \ apt-get install -y golang-go -RUN apt-get update -y ; apt-get install -y zbar-tools libzbar-dev python-zbar python3.7 -RUN rm /usr/bin/python ; ln -s /usr/bin/python3.7 /usr/bin/python ; apt-get install -y python3-pip +RUN apt-get update -y ; apt-get install -y zbar-tools libzbar-dev python-zbar python3.6 +RUN rm /usr/bin/python ; ln -s /usr/bin/python3.6 /usr/bin/python ; apt-get install -y python3-pip RUN python -m pip install --upgrade pip RUN wget -N http://chromedriver.storage.googleapis.com/2.40/chromedriver_linux64.zip && \ @@ -82,7 +85,7 @@ RUN apt-get update && apt install libnss3-tools && \ echo Harbor12345 > password.ca && \ certutil -d sql:$HOME/.pki/nssdb -N -f password.ca -RUN pip3 install pyasn1 google-apitools==0.5.31 gsutil robotframework==3.2.1 robotframework-sshlibrary robotframework-httplibrary requests dbbot robotframework-seleniumlibrary==4.3.0 robotframework-pabot robotframework-JSONLibrary --upgrade +RUN pip3 install pyasn1 google-apitools==0.5.31 gsutil robotframework==3.2.1 robotframework-sshlibrary robotframework-httplibrary requests dbbot robotframework-seleniumlibrary==4.3.0 robotframework-pabot robotframework-JSONLibrary hurry.filesize --upgrade ENV CONTAINERD_VERSION 1.4.3 RUN wget https://github.com/containerd/containerd/releases/download/v1.4.3/containerd-$CONTAINERD_VERSION-linux-amd64.tar.gz && \ @@ -147,8 +150,8 @@ RUN wget http://nchc.dl.sourceforge.net/sourceforge/tcl/tcl8.4.11-src.tar.gz && cd /ixdba.net/bin && \ mv expect /usr/local/bin/expect -RUN CNAB_PATH=$(go env GOPATH)/src/github.com/docker && mkdir -p $CNAB_PATH && cd $CNAB_PATH && git clone https://github.com/cnabio/cnab-to-oci.git && \ - cd cnab-to-oci && git checkout v0.3.0-beta4 && \ +RUN CNAB_PATH=$(go env GOPATH)/src/github.com/cnabio && mkdir -p $CNAB_PATH && cd $CNAB_PATH && git clone https://github.com/cnabio/cnab-to-oci.git && \ + cd cnab-to-oci && git checkout v0.3.1-beta1 && \ go list && \ make build && \ mv bin/cnab-to-oci /usr/local/bin diff --git a/tests/e2e-image/busybox.tar b/tests/e2e-image/busybox.tar new file mode 100644 index 000000000..05b5a2d38 Binary files /dev/null and b/tests/e2e-image/busybox.tar differ diff --git a/tests/resources/Docker-Util.robot b/tests/resources/Docker-Util.robot index 749dc8250..e669bdd07 100644 --- a/tests/resources/Docker-Util.robot +++ b/tests/resources/Docker-Util.robot @@ -27,7 +27,7 @@ Pull image Log To Console \nRunning docker pull ${image}... ${image_with_tag}= Set Variable If '${tag}'=='${null}' ${image} ${image}:${tag} Run Keyword If ${is_robot}==${false} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip} - ... ELSE Wait Unitl Command Success docker login -u robot\\\$${user} -p ${pwd} ${ip} + ... ELSE Wait Unitl Command Success docker login -u robot\\\$${project}+${user} -p ${pwd} ${ip} ${output}= Docker Pull ${ip}/${project}/${image_with_tag} Log ${output} Log To Console ${output} @@ -48,7 +48,7 @@ Push image ${image_in_use}= Set Variable If ${need_pull_first}==${true} ${image_in_use} ${image_with_or_without_tag} Run Keyword If ${need_pull_first}==${true} Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image_in_use} Run Keyword If ${is_robot}==${false} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip} - ... ELSE Wait Unitl Command Success docker login -u robot\\\$${user} -p ${pwd} ${ip} + ... ELSE Wait Unitl Command Success docker login -u robot\\\$${project}+${user} -p ${pwd} ${ip} Run Keyword If ${need_pull_first}==${true} Wait Unitl Command Success docker tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image_in_use} ${ip}/${project}/${image_in_use_with_tag} ... ELSE Wait Unitl Command Success docker tag ${image_in_use} ${ip}/${project}/${image_in_use_with_tag} Wait Unitl Command Success docker push ${ip}/${project}/${image_in_use_with_tag} @@ -70,8 +70,10 @@ Push Image With Tag Clean All Local Images Clean All Local Images - Wait Unitl Command Success docker rmi -f $(docker images -a -q) - Wait Unitl Command Success docker system prune -a -f + ${rc} ${out}= Run Keyword And Ignore Error Run docker rmi -f $(docker images -a -q) + Log All ${out} + ${rc} ${out}= Run Keyword And Ignore Error Run docker system prune -a -f + Log All ${out} Cannot Docker Login Harbor [Arguments] ${ip} ${user} ${pwd} @@ -79,6 +81,8 @@ Cannot Docker Login Harbor Cannot Pull Image [Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${tag}=${null} ${err_msg}=${null} + Restart Process Locally containerd + Restart Process Locally dockerd ${image_with_tag}= Set Variable If '${tag}'=='${null}' ${image} ${image}:${tag} Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip} FOR ${idx} IN RANGE 0 30 @@ -86,17 +90,11 @@ Cannot Pull Image Exit For Loop If '${out[0]}'=='PASS' Sleep 3 END + Clean All Local Images Log To Console Cannot Pull Image - Pull Log: ${out[1]} Should Be Equal As Strings '${out[0]}' 'PASS' Run Keyword If '${err_msg}' != '${null}' Should Contain ${out[1]} ${err_msg} -Cannot Pull Unsigned Image - [Arguments] ${ip} ${user} ${pass} ${proj} ${imagewithtag} - Wait Unitl Command Success docker login -u ${user} -p ${pass} ${ip} - ${output}= Command Should be Failed docker pull ${ip}/${proj}/${imagewithtag} - Log To Console ${output} - Should Contain ${output} The image is not signed in Notary - Cannot Push image [Arguments] ${ip} ${user} ${pwd} ${project} ${image} ${err_msg}=${null} ${err_msg_2}=${null} Log To Console \nRunning docker push ${image}... @@ -108,6 +106,7 @@ Cannot Push image Run Keyword If '${err_msg}' != '${null}' Should Contain ${output} ${err_msg} Run Keyword If '${err_msg_2}' != '${null}' Should Contain ${output} ${err_msg_2} Wait Unitl Command Success docker logout ${ip} + Clean All Local Images Wait Until Container Stops [Arguments] ${container} @@ -149,9 +148,9 @@ Start Docker Daemon Locally [Return] ${handle} Start Containerd Daemon Locally - ${handle}= Start Process containerd > ./daemon-local.log 2>&1 & shell=True + ${handle}= Start Process /usr/local/bin/containerd > ./daemon-local.log 2>&1 & shell=True FOR ${IDX} IN RANGE 5 - ${pid}= Run pidof containerd + ${pid}= Run pidof /usr/local/bin/containerd Log To Console pid: ${pid} Exit For Loop If '${pid}' != '${EMPTY}' Sleep 2s @@ -159,27 +158,40 @@ Start Containerd Daemon Locally Sleep 2s [Return] ${handle} -Restart Docker Daemon Locally +Restart Process Locally + [Arguments] ${process} + ${full_process}= Set Variable If + ... '${process}'=='containerd' /usr/local/bin/containerd dockerd + ${start_process_cmd}= Set Variable If + ... '${process}'=='dockerd' /usr/local/bin/dockerd-entrypoint.sh dockerd>./daemon-local.log 2>&1 + ... '${process}'=='containerd' ${full_process} > ./daemon-local.log 2>&1 & + Should Be True '${start_process_cmd}' != '${EMPTY}' + Run Keyword If '${process}'=='dockerd' OperatingSystem.File Should Exist /usr/local/bin/dockerd-entrypoint.sh + FOR ${IDX} IN RANGE 5 - ${pid}= Run pidof dockerd + ${pid}= Run pidof ${full_process} Exit For Loop If '${pid}' == '${EMPTY}' - ${result}= Run Process kill ${pid} shell=True + ${result}= Run kill ${pid} Log To Console Kill docker process: ${result} Sleep 2s END - ${pid}= Run pidof dockerd + ${pid}= Run pidof ${full_process} Should Be Equal As Strings '${pid}' '${EMPTY}' - OperatingSystem.File Should Exist /usr/local/bin/dockerd-entrypoint.sh - ${result}= Run Process rm -rf /var/lib/docker/* shell=True - Log To Console Clear /var/lib/docker: ${result} - ${handle}= Start Process /usr/local/bin/dockerd-entrypoint.sh dockerd>./daemon-local.log 2>&1 shell=True - Process Should Be Running ${handle} + + ${result}= Run rm -rf /var/lib/${process}/* + Log All Clear /var/lib/${process}: ${result} + ${handle}= Start Process ${start_process_cmd} shell=True + Log All handle : ${handle} FOR ${IDX} IN RANGE 5 - ${pid}= Run pidof dockerd + ${pid}= Run pidof ${full_process} + Log All pid : ${pid} Exit For Loop If '${pid}' != '${EMPTY}' Sleep 2s END Sleep 2s + #Process Should Be Running ${handle} + ${result}= Run ps aux |grep ${full_process} + Log All result : ${result} [Return] ${handle} Prepare Docker Cert @@ -217,7 +229,7 @@ Docker Login Docker Pull [Arguments] ${image} - ${output}= Retry Keyword N Times When Error 2 Wait Unitl Command Success docker pull ${image} + ${output}= Retry Keyword N Times When Error 6 Wait Unitl Command Success docker pull ${image} Log All Docker Pull: ${output} [Return] ${output} @@ -245,6 +257,7 @@ Docker Image Can Not Be Pulled Log To Console Docker pull return value is ${out} Sleep 3 END + Clean All Local Images Log To Console Cannot Pull Image From Docker - Pull Log: ${out[1]} Should Be Equal As Strings '${out[0]}' 'PASS' @@ -259,5 +272,6 @@ Docker Image Can Be Pulled Exit For Loop If '${out[0]}'=='PASS' Sleep 5 END + Clean All Local Images Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot - Should Be Equal As Strings '${out[0]}' 'PASS' \ No newline at end of file + Should Be Equal As Strings '${out[0]}' 'PASS' diff --git a/tests/resources/Harbor-Pages/Project.robot b/tests/resources/Harbor-Pages/Project.robot index 0f72cd4c7..64496943c 100644 --- a/tests/resources/Harbor-Pages/Project.robot +++ b/tests/resources/Harbor-Pages/Project.robot @@ -90,8 +90,9 @@ Switch To Project Tab Overflow Navigate To Projects Reload Page + Sleep 3 Retry Element Click xpath=${projects_xpath} - Sleep 2 + Sleep 1 Project Should Display [Arguments] ${projectname} @@ -235,12 +236,12 @@ Go Into Repo Retry Wait Until Page Not Contains Element ${repo_list_spinner} ${repo_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${repoName}')]/a FOR ${n} IN RANGE 1 3 - Reload Page Retry Element Click ${repo_search_icon} Retry Clear Element Text ${repo_search_input} Retry Text Input ${repo_search_input} ${repoName} ${out} Run Keyword And Ignore Error Retry Wait Until Page Contains Element ${repo_name_element} Sleep 2 + Run Keyword If '${out[0]}'=='FAIL' Reload Page Continue For Loop If '${out[0]}'=='FAIL' Retry Click Repo Name ${repo_name_element} Sleep 2 @@ -330,7 +331,7 @@ Get Statics Retry Get Statics [Arguments] ${locator} @{param} Create List ${locator} - ${ret}= Retry Keyword N Times When Error 3 Get Statics @{param} + ${ret}= Retry Keyword N Times When Error 5 Get Statics @{param} [Return] ${ret} Get Statics Private Repo diff --git a/tests/resources/Harbor-Pages/Project_Robot_Account.robot b/tests/resources/Harbor-Pages/Project_Robot_Account.robot index 6b28c5722..56875e680 100644 --- a/tests/resources/Harbor-Pages/Project_Robot_Account.robot +++ b/tests/resources/Harbor-Pages/Project_Robot_Account.robot @@ -16,7 +16,8 @@ Create A Robot Account And Return Token Switch To Project Robot Account Retry Element Click ${project_robot_account_create_btn} Retry Text Input ${project_robot_account_create_name_input} ${robot_account_name} - Retry Element Click ${project_robot_account_never_expired_chkbox} + Retry Element Click xpath=//select[@id='expiration-type'] + Retry Element Click xpath=//select[@id='expiration-type']//option[@value='never'] Retry Double Keywords When Error Retry Element Click ${project_robot_account_create_save_btn} Retry Wait Until Page Not Contains Element ${project_robot_account_create_save_btn} ${token}= Get Value ${project_robot_account_token_input} [Return] ${token} diff --git a/tests/resources/Harbor-Pages/Project_Robot_Account_Elements.robot b/tests/resources/Harbor-Pages/Project_Robot_Account_Elements.robot index f50389ae4..7e66f2a1b 100644 --- a/tests/resources/Harbor-Pages/Project_Robot_Account_Elements.robot +++ b/tests/resources/Harbor-Pages/Project_Robot_Account_Elements.robot @@ -5,6 +5,5 @@ Documentation This resource provides any keywords related to the Harbor robot-a ${project_robot_account_tabpage} xpath=//project-detail//a[contains(.,'Robot Accounts')] ${project_robot_account_create_btn} xpath=//project-detail/app-robot-account//button ${project_robot_account_token_input} xpath=//app-robot-account//hbr-copy-input//input -${project_robot_account_never_expired_chkbox} xpath=//add-robot//clr-checkbox-wrapper/label[contains(.,'Never Expired')] -${project_robot_account_create_name_input} //input[@id='robot_name'] -${project_robot_account_create_save_btn} //add-robot//button[contains(.,'SAVE')] +${project_robot_account_create_name_input} //input[@id='name'] +${project_robot_account_create_save_btn} //button[@id='system-robot-save'] diff --git a/tests/resources/Harbor-Pages/Replication.robot b/tests/resources/Harbor-Pages/Replication.robot index fc1f89376..ba47f6de8 100644 --- a/tests/resources/Harbor-Pages/Replication.robot +++ b/tests/resources/Harbor-Pages/Replication.robot @@ -229,7 +229,7 @@ Select Rule And Replicate Retry Double Keywords When Error Retry Element Click xpath=${dialog_replicate} Retry Wait Until Page Not Contains Element xpath=${dialog_replicate} Image Should Be Replicated To Project - [Arguments] ${project} ${image} ${period}=60 ${times}=3 ${tag}=${null} ${expected_image_size_in_regexp}=${null} + [Arguments] ${project} ${image} ${period}=60 ${times}=20 ${tag}=${null} ${expected_image_size_in_regexp}=${null} FOR ${n} IN RANGE 0 ${times} Sleep ${period} Go Into Project ${project} diff --git a/tests/resources/Harbor-Pages/Verify.robot b/tests/resources/Harbor-Pages/Verify.robot index 2eb4a94f1..50a2b5dce 100644 --- a/tests/resources/Harbor-Pages/Verify.robot +++ b/tests/resources/Harbor-Pages/Verify.robot @@ -1,4 +1,5 @@ *** settings *** +Library ../../robot-cases/Group3-Upgrade/util.py Resource ../../resources/Util.robot *** Keywords *** @@ -548,15 +549,22 @@ Loop P2P Preheat Policys Verify Quotas Display [Arguments] ${json} Log To Console "Verify Quotas Display..." - @{project}= Get Value From Json ${json} $.projects.[*].name + @{project}= Get Value From Json ${json} $.quotas.[*].name Init Chrome Driver Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} FOR ${project} IN @{project} - ${is_proxy_project}= Evaluate "proxy" in """${project}""" - Continue For Loop If '${is_proxy_project}' == '${true}' ${storage_quota_ret}= Get Project Storage Quota Text From Project Quotas List ${project} - ${storage_quota_expected_display}= Get Value From Json ${json} $.projects[?(@.name=${project})].quotas_usage_display - Log All storage_quota_expected_display:${storage_quota_expected_display} - Should Match Regexp ${storage_quota_ret} ${storage_quota_expected_display}[0] + ${storage_limit}= Get Value From Json ${json} $.quotas[?(@.name=${project})].storage_limit + ${size}= Get Value From Json ${json} $.quotas[?(@.name=${project})].size + ${size_in_mb}= Evaluate ${size}[0] * 1024 * 1024 + ${storage_usage}= Convert Int To Readable File Size ${size_in_mb} + ${storage_usage_without_unit}= Get Substring ${storage_usage} 0 -2 + ${storage_usage_unit}= Get Substring ${storage_usage} -2 + ${storage_total_size}= Convert Int To Readable File Size ${storage_limit}[0] + Log All storage_usage_without_unit:${storage_usage_without_unit} + 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} END Close Browser \ No newline at end of file diff --git a/tests/resources/Harbor-Util.robot b/tests/resources/Harbor-Util.robot index cdb207aeb..a326d7d65 100644 --- a/tests/resources/Harbor-Util.robot +++ b/tests/resources/Harbor-Util.robot @@ -97,9 +97,16 @@ Enable Notary Client Log ${output} Should Be Equal As Integers ${rc} 0 -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} ${notaryServerEndpoint} +Notary Remove Signature + [Arguments] ${ip} ${project} ${image} ${tag} ${user} ${pwd} + ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-util.sh remove ${ip} ${project} ${image} ${tag} ${notaryServerEndpoint} ${user} ${pwd} + Log To Console ${output} + Log ${output} + Should Be Equal As Integers ${rc} 0 + +Notary Key Rotate + [Arguments] ${ip} ${project} ${image} ${tag} ${user} ${pwd} + ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-util.sh key_rotate ${ip} ${project} ${image} ${tag} ${notaryServerEndpoint} ${user} ${pwd} Log To Console ${output} Log ${output} Should Be Equal As Integers ${rc} 0 diff --git a/tests/resources/Nightly-Util.robot b/tests/resources/Nightly-Util.robot index df1074035..561268d02 100644 --- a/tests/resources/Nightly-Util.robot +++ b/tests/resources/Nightly-Util.robot @@ -53,9 +53,6 @@ Nightly Test Setup For Nightly Run Keyword Start Docker Daemon Locally Log To Console Start Containerd Daemon Locally ... Run Keyword Start Containerd Daemon Locally - #Prepare docker image for push special image keyword in replication test - Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/busybox:latest - Docker Tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/busybox:latest busybox:latest CA Setup For Nightly [Arguments] ${ip} ${HARBOR_PASSWORD} ${cert}=/ca/ca.crt diff --git a/tests/resources/TestCaseBody.robot b/tests/resources/TestCaseBody.robot index c993fa0b7..cc2b14a23 100644 --- a/tests/resources/TestCaseBody.robot +++ b/tests/resources/TestCaseBody.robot @@ -153,22 +153,34 @@ Body Of List Helm Charts Multi-delete Chart Files ${prometheus_chart_name} ${harbor_chart_name} Close Browser +Body Of Push Signed Image + Init Chrome Driver + ${d}= Get Current Date result_format=%m%s + ${user}= Set Variable user010 + ${pwd}= Set Variable Test1@34 + Sign In Harbor ${HARBOR_URL} ${user} ${pwd} + Create An New Project And Go Into Project project${d} + Body Of Admin Push Signed Image project${d} tomcat latest ${user} ${pwd} + Body Of Admin Push Signed Image project${d} alpine latest ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Close Browser + Body Of Admin Push Signed Image - [Arguments] ${image}=tomcat ${project}=library ${with_remove}=${false} + [Arguments] ${project} ${image} ${tag} ${user} ${pwd} ${with_remove}=${false} Enable Notary Client Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image} - ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${project} ${image} latest ${notaryServerEndpoint} ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:latest + ${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${project} ${image} ${tag} ${notaryServerEndpoint} ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:${tag} ${user} ${pwd} + Clean All Local Images 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/latest?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" Log To Console ${output} Should Be Equal As Integers ${rc} 0 Should Contain ${output} "signed":true - Run Keyword If ${with_remove} == ${true} Remove Notary Signature ${ip} ${image} + Run Keyword If ${with_remove} == ${true} Notary Remove Signature ${ip} ${project} ${image} ${tag} ${user} ${pwd} Delete A Project Without Sign In Harbor [Arguments] ${harbor_ip}=${ip} ${username}=${HARBOR_ADMIN} ${password}=${HARBOR_PASSWORD} @@ -366,4 +378,4 @@ Body Of Replication Of Pull Images from Registry To Self Log To Console Check image replicated to Project ${_des_pro_name} ${item} Image Should Be Replicated To Project ${_des_pro_name} ${item} times=2 END - Close Browser \ No newline at end of file + Close Browser diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index 83d6e38cf..db06b0b34 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -90,7 +90,7 @@ Wait Until Element Is Visible And Enabled Retry Action Keyword [Arguments] ${keyword} @{param} - Retry Keyword N Times When Error 3 ${keyword} @{param} + Retry Keyword N Times When Error 4 ${keyword} @{param} Retry Wait Element [Arguments] ${element_xpath} diff --git a/tests/robot-cases/Group0-BAT/API_DB.robot b/tests/robot-cases/Group0-BAT/API_DB.robot index ef4b65ec6..e1ad73d94 100644 --- a/tests/robot-cases/Group0-BAT/API_DB.robot +++ b/tests/robot-cases/Group0-BAT/API_DB.robot @@ -159,5 +159,4 @@ Test Case - Metrics Test Case - Project Level Policy Content Trust [Tags] content_trust - Restart Docker Daemon Locally Harbor API Test ./tests/apitests/python/test_project_level_policy_content_trust.py diff --git a/tests/robot-cases/Group0-Util/notary-push-image.sh b/tests/robot-cases/Group0-Util/notary-push-image.sh index f3a9366bf..9dbdf786d 100755 --- a/tests/robot-cases/Group0-Util/notary-push-image.sh +++ b/tests/robot-cases/Group0-Util/notary-push-image.sh @@ -3,7 +3,9 @@ #docker pull $3:$4 IP=$1 -PASSHRASE='Harbor12345' +USER=$7 +PWD=$8 +PASSHRASE=$8 notaryServerEndpoint=$5 tag_src=$6 echo $IP @@ -28,6 +30,6 @@ export DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE=$PASSHRASE export DOCKER_CONTENT_TRUST_OFFLINE_PASSPHRASE=$PASSHRASE export DOCKER_CONTENT_TRUST_TAGGING_PASSPHRASE=$PASSHRASE -docker login -u admin -p Harbor12345 $IP +docker login -u $USER -p $PWD $IP docker tag $tag_src $IP/$2/$3:$4 docker push $IP/$2/$3:$4 diff --git a/tests/robot-cases/Group0-Util/notary-util.sh b/tests/robot-cases/Group0-Util/notary-util.sh new file mode 100755 index 000000000..900ad46ed --- /dev/null +++ b/tests/robot-cases/Group0-Util/notary-util.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +CMD=$1 +HOST=$2 +PROJECT=$3 +IMAGE=$4 +TAG=$5 +NOTARY_SERVER_ENDPOINT=$6 +USER=$7 +PWD=$8 +PASSHRASE=$8 + +export DOCKER_CONTENT_TRUST=1 + +export NOTARY_ROOT_PASSPHRASE=$PASSHRASE +export NOTARY_TARGETS_PASSPHRASE=$PASSHRASE +export NOTARY_SNAPSHOT_PASSPHRASE=$PASSHRASE +export DOCKER_CONTENT_TRUST_ROOT_PASSPHRASE=$PASSHRASE +export DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE=$PASSHRASE +export DOCKER_CONTENT_TRUST_OFFLINE_PASSPHRASE=$PASSHRASE +export DOCKER_CONTENT_TRUST_TAGGING_PASSPHRASE=$PASSHRASE + +export NOTARY_AUTH=$(echo $USER:$PWD | base64) +echo $USER:$PWD + +NOTARY_CMD_OPTIONS="notary -s https://$NOTARY_SERVER_ENDPOINT --tlscacert /notary_ca.crt -d /root/.docker/trust" +if [ "$CMD" == "key_rotate" ]; then + echo "$NOTARY_CMD_OPTIONS key rotate $HOST/$PROJECT/$IMAGE snapshot -r" + $NOTARY_CMD_OPTIONS key rotate $HOST/$PROJECT/$IMAGE snapshot -r +elif [ "$CMD" == "remove" ]; then + echo "$NOTARY_CMD_OPTIONS remove -p $HOST/$PROJECT/$IMAGE $TAG" + $NOTARY_CMD_OPTIONS remove -p $HOST/$PROJECT/$IMAGE $TAG +fi diff --git a/tests/robot-cases/Group1-Nightly/Common.robot b/tests/robot-cases/Group1-Nightly/Common.robot index e5a33cd6f..90f7150b8 100644 --- a/tests/robot-cases/Group1-Nightly/Common.robot +++ b/tests/robot-cases/Group1-Nightly/Common.robot @@ -610,18 +610,18 @@ Test Case - Tag Immutability Delete Success busybox Close Browser -#TODO in 2.2: Modify this case when new robot account feature is ready. -#Test Case - Robot Account -# Init Chrome Driver -# ${d}= Get Current Date result_format=%m%s -# Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} -# Create An New Project And Go Into Project project${d} -# ${token}= Create A Robot Account And Return Token project${d} robot${d} -# Log To Console ${token} -# Log ${token} -# Push image ${ip} robot${d} ${token} project${d} hello-world:latest is_robot=${true} -# Pull image ${ip} robot${d} ${token} project${d} hello-world:latest is_robot=${true} -# Close Browser +Test Case - Robot Account + [tags] robot_account + Init Chrome Driver + ${d}= Get Current Date result_format=%m%s + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Create An New Project And Go Into Project project${d} + ${token}= Create A Robot Account And Return Token project${d} robot${d} + Log To Console ${token} + Log ${token} + Push image ${ip} robot${d} ${token} project${d} hello-world:latest is_robot=${true} + Pull image ${ip} robot${d} ${token} project${d} hello-world:latest is_robot=${true} + Close Browser Test Case - Push Docker Manifest Index and Display Init Chrome Driver diff --git a/tests/robot-cases/Group1-Nightly/Nightly.robot b/tests/robot-cases/Group1-Nightly/Nightly.robot deleted file mode 100644 index 92b3ac438..000000000 --- a/tests/robot-cases/Group1-Nightly/Nightly.robot +++ /dev/null @@ -1,675 +0,0 @@ -// Copyright (c) 2017 VMware, Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -*** Settings *** -Documentation Harbor BATs -Resource ../../resources/Util.robot -Suite Setup Nightly Test Setup ${ip} ${SSH_PWD} ${HARBOR_PASSWORD} ${ip1} -Suite Teardown Collect Nightly Logs ${ip} ${SSH_PWD} ${ip1} -Default Tags Nightly - -*** Variables *** -${HARBOR_URL} https://${ip} -${SSH_USER} root -${HARBOR_ADMIN} admin - -*** Test Cases *** -Test Case - Get Harbor Version -#Just get harbor version and log it - Get Harbor Version - -Test Case - Read Only Mode - 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 - - Enable Read Only - Cannot Push image ${ip} tester${d} Test1@34 project${d} busybox:latest - - Disable Read Only - Push image ${ip} tester${d} Test1@34 project${d} busybox:latest - Close Browser - -Test Case - Repo Size - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library alpine 2.6 2.6 - Go Into Project library - Go Into Repo alpine - Page Should Contain 1.92MB - Close Browser - -Test Case - Staticsinfo - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - ${privaterepocount1}= Get Statics Private Repo - ${privateprojcount1}= Get Statics Private Project - ${publicrepocount1}= Get Statics Public Repo - ${publicprojcount1}= Get Statics Public Project - ${totalrepocount1}= Get Statics Total Repo - ${totalprojcount1}= Get Statics Total Project - Create An New Project private${d} - Create An New Project public${d} true - Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} private${d} hello-world - Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} public${d} hello-world - Reload Page - ${privaterepocount2}= Get Statics Private Repo - ${privateprojcount2}= get statics private project - ${publicrepocount2}= get statics public repo - ${publicprojcount2}= get statics public project - ${totalrepocount2}= get statics total repo - ${totalprojcount2}= get statics total project - ${privateprojcount}= evaluate ${privateprojcount1}+1 - ${privaterepocount}= evaluate ${privaterepocount1}+1 - ${publicprojcount}= evaluate ${publicprojcount1}+1 - ${publicrepocount}= evaluate ${publicrepocount1}+1 - ${totalrepocount}= evaluate ${totalrepocount1}+2 - ${totalprojcount}= evaluate ${totalprojcount1}+2 - Should Be Equal As Integers ${privateprojcount2} ${privateprojcount} - Should be equal as integers ${privaterepocount2} ${privaterepocount} - Should be equal as integers ${publicprojcount2} ${publicprojcount} - Should be equal as integers ${publicrepocount2} ${publicrepocount} - Should be equal as integers ${totalprojcount2} ${totalprojcount} - Should be equal as integers ${totalrepocount2} ${totalrepocount} - -Test Case - Create An New User - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest - Close Browser - -Test Case - Sign With Admin - Init Chrome Driver - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Close Browser - -Test Case - Update User Comment - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest - Update User Comment Test12#4 - Logout Harbor - -Test Case - Update Password - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest - Change Password Test1@34 Test12#4 - Logout Harbor - Sign In Harbor ${HARBOR_URL} tester${d} Test12#4 - Close Browser - -Test Case - Create An New Project - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest - Create An New Project test${d} - Close Browser - -Test Case - User View Projects - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest - Create An New Project test${d}1 - Create An New Project test${d}2 - Create An New Project test${d}3 - Switch To Log - Wait Until Page Contains test${d}1 - Wait Until Page Contains test${d}2 - Wait Until Page Contains test${d}3 - Close Browser - -Test Case - Push Image - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest - Create An New Project test${d} - - Push image ${ip} tester${d} Test1@34 test${d} hello-world:latest - Go Into Project test${d} - Wait Until Page Contains test${d}/hello-world - -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 - - Push image ${ip} tester${d} Test1@34 project${d} busybox:latest - Pull image ${ip} tester${d} Test1@34 project${d} busybox:latest - - Go Into Project project${d} - Delete Repo project${d} - - Go To Project Log - Advanced Search Should Display - - Do Log Advanced Search - Close Browser - -Test Case - Manage project publicity - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - - Create An New User url=${HARBOR_URL} username=usera${d} email=usera${d}@vmware.com realname=usera${d} newPassword=Test1@34 comment=harbor - Logout Harbor - Create An New User url=${HARBOR_URL} username=userb${d} email=userb${d}@vmware.com realname=userb${d} newPassword=Test1@34 comment=harbor - Logout Harbor - - Sign In Harbor ${HARBOR_URL} usera${d} Test1@34 - Create An New Project project${d} public=true - - Push image ${ip} usera${d} Test1@34 project${d} hello-world:latest - Pull image ${ip} userb${d} Test1@34 project${d} hello-world:latest - - Logout Harbor - Sign In Harbor ${HARBOR_URL} userb${d} Test1@34 - Project Should Display project${d} - Search Private Projects - Project Should Not Display project${d} - - Logout Harbor - Sign In Harbor ${HARBOR_URL} usera${d} Test1@34 - Make Project Private project${d} - - Logout Harbor - Sign In Harbor ${HARBOR_URL} userb${d} Test1@34 - Project Should Not Display project${d} - Cannot Pull Image ${ip} userb${d} Test1@34 project${d} hello-world:latest - - Logout Harbor - Sign In Harbor ${HARBOR_URL} usera${d} Test1@34 - Make Project Public project${d} - - Logout Harbor - Sign In Harbor ${HARBOR_URL} userb${d} Test1@34 - Project Should Display project${d} - Close Browser - -Test Case - Project Level Policy Public - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Create An New Project project${d} - Go Into Project project${d} has_image=${false} - Goto Project Config - Click Project Public - Save Project Config - # Verify - Public Should Be Selected - # Project${d} default should be private - # Here logout and login to try avoid a bug only in autotest - Logout Harbor - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Filter Object project${d} - Project Should Be Public project${d} - Close Browser - -Test Case - Project Level Policy Content Trust - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Create An New Project project${d} - Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world:latest - Go Into Project project${d} - Goto Project Config - Click Content Trust - Save Project Config - # Verify - Content Trust Should Be Selected - Cannot Pull Unsigned Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world:latest - Close Browser - -Test Case - Edit Project Creation - # Create normal user and login - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest - - Project Creation Should Display - Logout Harbor - - Sleep 3 - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Set Pro Create Admin Only - Logout Harbor - - Sign In Harbor ${HARBOR_URL} tester${d} Test1@34 - Project Creation Should Not Display - Logout Harbor - - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Set Pro Create Every One - Close browser - -Test Case - Edit Self-Registration - Init Chrome Driver - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Disable Self Reg - Logout Harbor - - Sign Up Should Not Display - - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To Configure - Self Reg Should Be Disabled - Sleep 1 - - # Restore setting - Enable Self Reg - Close Browser - -Test Case - Edit Email Settings - Init Chrome Driver - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - - Switch To Email - Config Email - - Logout Harbor - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - - Switch To Email - Verify Email - - Close Browser - -Test Case - Edit Token Expire - Init Chrome Driver - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To System Settings - Modify Token Expiration 20 - Logout Harbor - - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To System Settings - Token Must Be Match 20 - - #reset to default - Modify Token Expiration 30 - Close Browser - -Test Case - Create A New Labels - Init Chrome Driver - ${d}= Get Current Date - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To System Labels - Create New Labels label_${d} - Close Browser - -Test Case - Update Label - Init Chrome Driver - ${d}= Get Current Date - - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To System Labels - Create New Labels label_${d} - Sleep 3 - ${d1}= Get Current Date - Update A Label label_${d} - Close Browser - -Test Case - Delete Label - Init Chrome Driver - ${d}= Get Current Date - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To System Labels - Create New Labels label_${d} - Sleep 3 - Delete A Label label_${d} - Close Browser - -TestCase - Project Admin Operate Labels - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@vmware.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false - - Go Into Project project${d} has_image=${false} - Sleep 2 - # Add labels - Switch To Project Label - Create New Labels label_${d} - Sleep 2 - Update A Label label_${d} - Sleep 2 - Delete A Label label_${d} - Close Browser - -TestCase - Project Admin Add Labels To Repo - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@vmware.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false - ## Push Image With Tag ${ip} test${d} Test1@34 project${d} vmware/photon 1.0 1.0 - Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 3.2.10-alpine 3.2.10-alpine - Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 4.0.7-alpine 4.0.7-alpine - - Go Into Project project${d} - Sleep 2 - # Add labels - Switch To Project Label - Create New Labels label111 - Create New Labels label22 - Sleep 2 - Switch To Project Repo - Go Into Repo project${d}/redis - Add Labels To Tag 3.2.10-alpine label111 - Add Labels To Tag 4.0.7-alpine label22 - Filter Labels In Tags label111 label22 - Close Browser - -TestCase - Developer Operate Labels - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@vmware.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false - Logout Harbor - Create An New User url=${HARBOR_URL} username=bob${d} email=bob${d}@vmware.com realname=bob${d} newPassword=Test1@34 comment=habor - Logout Harbor - - Manage Project Member test${d} Test1@34 project${d} bob${d} Add has_image=${false} - Change User Role In Project test${d} Test1@34 project${d} bob${d} Developer - - Sign In Harbor ${HARBOR_URL} bob${d} Test1@34 - Go Into Project project${d} has_image=${false} - Sleep 3 - Retry Wait Until Page Not Contains Element xpath=//a[contains(.,'Labels')] - Close Browser - -Test Case - Scan A Tag In The Repo - 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=false - Push Image ${ip} tester${d} Test1@34 project${d} hello-world - Go Into Project project${d} - Go Into Repo project${d}/hello-world - Scan Repo latest Succeed - Summary Chart Should Display latest - Pull Image ${ip} tester${d} Test1@34 project${d} hello-world - # Edit Repo Info - Close Browser - -Test Case - Scan As An Unprivileged User - Init Chrome Driver - ${d}= get current date result_format=%m%s - Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world - Create An New User ${HARBOR_URL} user${d} user${d}@vmware.com user${d} Test1@34 harbor - Go Into Project library - Go Into Repo hello-world - Select Object latest - Scan Is Disabled - Close Browser -## -Test Case - Scan Image With Empty Vul - Init Chrome Driver - Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Go Into Project library - Go Into Repo hello-world - Scan Repo latest Succeed - Move To Summary Chart - Wait Until Page Contains No vulnerability - Close Browser -### -Test Case - Disable Scan Schedule - Init Chrome Driver - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To Vulnerability Page - Disable Scan Schedule - Logout Harbor - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To Vulnerability Page - Page Should Contain None - Close Browser -### -Test Case - Manual Scan All - Init Chrome Driver - Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library redis - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To Vulnerability Page - Trigger Scan Now And Wait Until The Result Appears - Navigate To Projects - Go Into Project library - Go Into Repo redis - Summary Chart Should Display latest - Close Browser -# -Test Case - Project Level Image Serverity Policy - Init Chrome Driver - Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library haproxy - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Go Into Project library - Go Into Repo haproxy - Scan Repo latest Succeed - Navigate To Projects - Go Into Project library - Set Vulnerabilty Serverity 0 - Cannot pull image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library haproxy - Close Browser - -Test Case - Verify Download Ca Link - Init Chrome Driver - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch To System Settings - Page Should Contain Registry Root Certificate - Close Browser - -Test Case - Edit Repo Info - 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=false - Push Image ${ip} tester${d} Test1@34 project${d} hello-world - Go Into Project project${d} - Go Into Repo project${d}/hello-world - Edit Repo Info - Close Browser - -Test Case - Manage Project Member - Init Chrome Driver - ${d}= Get current Date result_format=%m%s - - Create An New Project With New User url=${HARBOR_URL} username=alice${d} email=alice${d}@vmware.com realname=alice${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false - Push image ip=${ip} user=alice${d} pwd=Test1@34 project=project${d} image=hello-world - Logout Harbor - Create An New User url=${HARBOR_URL} username=bob${d} email=bob${d}@vmware.com realname=bob${d} newPassword=Test1@34 comment=habor - Logout Harbor - Create An New User url=${HARBOR_URL} username=carol${d} email=carol${d}@vmware.com realname=carol${d} newPassword=Test1@34 comment=harbor - Logout Harbor - - User Should Not Be A Member Of Project bob${d} Test1@34 project${d} - Manage Project Member alice${d} Test1@34 project${d} bob${d} Add - User Should Be Guest bob${d} Test1@34 project${d} - Change User Role In Project alice${d} Test1@34 project${d} bob${d} Developer - User Should Be Developer bob${d} Test1@34 project${d} - Change User Role In Project alice${d} Test1@34 project${d} bob${d} Admin - User Should Be Admin bob${d} Test1@34 project${d} carol${d} - Manage Project Member alice${d} Test1@34 project${d} bob${d} Remove - User Should Not Be A Member Of Project bob${d} Test1@34 project${d} - User Should Be Guest carol${d} Test1@34 project${d} - - Close Browser - -Test Case - Delete A Project - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New Project With New User ${HARBOR_URL} tester${d} tester${d}@vmware.com tester${d} Test1@34 harobr project${d} false - Push Image ${ip} tester${d} Test1@34 project${d} hello-world - Project Should Not Be Deleted project${d} - Go Into Project project${d} - Delete Repo project${d} - Navigate To Projects - Project Should Be Deleted project${d} - Close Browser - -Test Case - Delete Multi Project - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor - Create An New Project projecta${d} - Create An New Project projectb${d} - Push Image ${ip} test${d} Test1@34 projecta${d} hello-world - Filter Object project - @{project_list} Create List projecta projectb - Multi-delete Object ${project_delete_btn} @{project_list} - # Verify delete project with image should not be deleted directly - Delete Fail projecta${d} - Delete Success projectb${d} - Close Browser - -Test Case - Delete Multi User - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User ${HARBOR_URL} deletea${d} testa${d}@vmware.com test${d} Test1@34 harbor - Logout Harbor - Create An New User ${HARBOR_URL} deleteb${d} testb${d}@vmware.com test${d} Test1@34 harbor - Logout Harbor - Create An New User ${HARBOR_URL} deletec${d} testc${d}@vmware.com test${d} Test1@34 harbor - Logout Harbor - Sign In Harbor ${HARBOR_URL} admin Harbor12345 - Switch To User Tag - Filter Object delete - @{user_list} Create List deletea deleteb deletec - Multi-delete Object ${user_delete_btn} @{user_list} - # Assert delete - Delete Success deletea deleteb deletec - Sleep 1 - Close Browser - -Test Case - Delete Multi Repo - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor - Create An New Project project${d} - Push Image ${ip} test${d} Test1@34 project${d} hello-world - Push Image ${ip} test${d} Test1@34 project${d} busybox - Sleep 2 - Go Into Project project${d} - @{repo_list} Create List hello-world busybox - Multi-delete Object ${repo_delete_btn} @{repo_list} - # Verify - Delete Success hello-world busybox - Close Browser - -Test Case - Delete Multi Tag - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor - Create An New Project project${d} - Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 3.2.10-alpine 3.2.10-alpine - Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 4.0.7-alpine 4.0.7-alpine - Sleep 2 - Go Into Project project${d} - Go Into Repo redis - @{tag_list} Create List 3.2.10-alpine 4.0.7-alpine - Multi-delete object ${tag_delete_btn} @{tag_list} - # Verify - Delete Success 3.2.10-alpine 4.0.7-alpine - Close Browser - -Test Case - Delete Repo on CardView - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor - Create An New Project project${d} - Push Image ${ip} test${d} Test1@34 project${d} hello-world - Push Image ${ip} test${d} Test1@34 project${d} busybox - Sleep 2 - Go Into Project project${d} - Switch To CardView - Delete Repo on CardView busybox - # Verify - Delete Success busybox - Close Browser - -Test Case - Delete Multi Member - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User ${HARBOR_URL} testa${d} testa${d}@vmware.com test${d} Test1@34 harbor - Logout Harbor - Create An New User ${HARBOR_URL} testb${d} testb${d}@vmware.com test${d} Test1@34 harbor - Logout Harbor - Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor - Create An New Project project${d} - Go Into Project project${d} has_image=${false} - Switch To Member - Add Guest Member to project testa${d} - Add Guest Member to project testb${d} - Multi-delete Member testa${d} testb${d} - Delete Success testa${d} testb${d} - Close Browser - -Test Case - Assign Sys Admin - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest - Logout Harbor - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Switch to User Tag - Assign User Admin tester${d} - Logout Harbor - Sign In Harbor ${HARBOR_URL} tester${d} Test1@34 - Administration Tag Should Display - Close Browser - -Test Case - Admin Push Signed Image - Enable 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/Group0-Util/notary-push-image.sh ${ip} - 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 - View Scan Results - 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=false - Push Image ${ip} tester${d} Test1@34 project${d} tomcat - Go Into Project project${d} - Go Into Repo project${d}/tomcat - Scan Repo latest Succeed - Summary Chart Should Display latest - View Repo Scan Details - Close Browser - -Test Case - View Scan Error - 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=false - Push Image ${ip} tester${d} Test1@34 project${d} vmware/photon:1.0 - Go Into Project project${d} - Go Into Repo project${d}/vmware/photon - Scan Repo 1.0 Fail - View Scan Error Log - Close Browser - -Test Case - Scan Image On Push - Init Chrome Driver - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Go Into Project library - Goto Project Config - Enable Scan On Push - Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library memcached - Navigate To Projects - Go Into Project library - Go Into Repo memcached - Summary Chart Should Display latest - Close Browser diff --git a/tests/robot-cases/Group1-Nightly/Notary.robot b/tests/robot-cases/Group1-Nightly/Notary.robot index 0b5ba8c51..588fcc6bd 100644 --- a/tests/robot-cases/Group1-Nightly/Notary.robot +++ b/tests/robot-cases/Group1-Nightly/Notary.robot @@ -25,7 +25,6 @@ ${HARBOR_ADMIN} admin *** Test Cases *** Test Case - Project Level Policy Content Trust - Restart Docker Daemon Locally Init Chrome Driver ${d}= Get Current Date result_format=%m%s Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} @@ -40,12 +39,34 @@ Test Case - Project Level Policy Content Trust Content Trust Should Be Selected Cannot Pull Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world:latest err_msg=The image is not signed in Notary # Signed image can be pulled - Body Of Admin Push Signed Image image=redis project=project${d} + Body Of Admin Push Signed Image project${d} redis latest ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Pull image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} redis tag=latest Close Browser Test Case - Admin Push Signed Image - Body Of Admin Push Signed Image + [tags] sign_image + Body Of Push Signed Image Test Case - Admin Push Signed Image And Remove Signature - Body Of Admin Push Signed Image image=alpine with_remove=${true} + [tags] rm_signature + Init Chrome Driver + ${d}= Get Current Date result_format=%m%s + ${user}= Set Variable user012 + ${pwd}= Set Variable Test1@34 + Sign In Harbor ${HARBOR_URL} ${user} ${pwd} + Create An New Project And Go Into Project project${d} + Body Of Admin Push Signed Image project${d} alpine latest ${user} ${pwd} with_remove=${true} + Body Of Admin Push Signed Image project${d} busybox latest ${HARBOR_ADMIN} ${HARBOR_PASSWORD} with_remove=${true} + +Test Case - Key Rotate + [tags] key_rotate + Init Chrome Driver + ${d}= Get Current Date result_format=%m%s + ${user}= Set Variable user012 + ${pwd}= Set Variable Test1@34 + Sign In Harbor ${HARBOR_URL} ${user} ${pwd} + Create An New Project And Go Into Project project${d} + Body Of Admin Push Signed Image project${d} busybox latest ${user} ${pwd} + Notary Key Rotate ${ip} project${d} busybox latest ${user} ${pwd} + Body Of Admin Push Signed Image project${d} alpine latest ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Notary Key Rotate ${ip} project${d} alpine latest ${HARBOR_ADMIN} ${HARBOR_PASSWORD} diff --git a/tests/robot-cases/Group1-Nightly/Upgrade.robot b/tests/robot-cases/Group1-Nightly/Upgrade.robot index c1013be45..b608da7eb 100644 --- a/tests/robot-cases/Group1-Nightly/Upgrade.robot +++ b/tests/robot-cases/Group1-Nightly/Upgrade.robot @@ -34,4 +34,5 @@ Test Case - List Helm Charts Body Of List Helm Charts Test Case - Admin Push Signed Image - Body Of Admin Push Signed Image + [tags] sign_image + Body Of Push Signed Image diff --git a/tests/robot-cases/Group3-Upgrade/data.json b/tests/robot-cases/Group3-Upgrade/data.json index 91e22269e..6e570e900 100644 --- a/tests/robot-cases/Group3-Upgrade/data.json +++ b/tests/robot-cases/Group3-Upgrade/data.json @@ -176,9 +176,6 @@ "p2p_preheat_policy":null, "count_limit":1234, "storage_limit":53687091200, - "storage_limit_for_verify":50, - "storage_unit_for_verify":"GB", - "quotas_usage_display":"9.4\\d*MB of 50GB", "replications":{ "rulename":"ruleproject1", "endpointname":"endpoint_for_proxy_cache", @@ -299,9 +296,6 @@ ], "count_limit":-1, "storage_limit":32985348833280, - "storage_limit_for_verify":30, - "storage_unit_for_verify":"TB", - "quotas_usage_display":"0Byte of 30TB", "replications":{ "rulename":"rulename1", "endpointname":"endpoint_for_proxy_cache", @@ -432,9 +426,6 @@ ], "count_limit":-1, "storage_limit":57671680, - "storage_limit_for_verify":55, - "storage_unit_for_verify":"MB", - "quotas_usage_display":"of 55MB", "labels":[ { "name":"proj2label1" @@ -523,5 +514,19 @@ } } } + ], + "quotas":[ + { + "name":"pro_quota_1", + "size":25, + "count_limit":1234, + "storage_limit":57671680 + }, + { + "name":"pro_quota_2", + "size":1024, + "count_limit":1234, + "storage_limit":53687091200 + } ] } diff --git a/tests/robot-cases/Group3-Upgrade/feature_map.json b/tests/robot-cases/Group3-Upgrade/feature_map.json index dfd0c8867..2df2163f3 100644 --- a/tests/robot-cases/Group3-Upgrade/feature_map.json +++ b/tests/robot-cases/Group3-Upgrade/feature_map.json @@ -490,5 +490,23 @@ "branch":2, "version":"2.2" } + ], + "populate_quotas":[ + { + "branch":1, + "version":"1.10" + }, + { + "branch":1, + "version":"2.0" + }, + { + "branch":1, + "version":"2.1" + }, + { + "branch":1, + "version":"2.2" + } ] } diff --git a/tests/robot-cases/Group3-Upgrade/prepare.py b/tests/robot-cases/Group3-Upgrade/prepare.py index 7fb27c5fa..bc258d838 100644 --- a/tests/robot-cases/Group3-Upgrade/prepare.py +++ b/tests/robot-cases/Group3-Upgrade/prepare.py @@ -58,14 +58,12 @@ class HarborAPI: @get_feature_branch def populate_projects(self, **kwargs): for project in data["projects"]: - if kwargs["branch"] == 1: - if project["registry_name"] is not None: - continue - elif kwargs["branch"] == 2: - if project["registry_name"] is not None: - continue + if kwargs["branch"] in [1,2]: + if "registry_name" in project: + print("Populate proxy project...") + # continue elif kwargs["branch"] == 3: - print("Populate all projects") + print("Populate all projects...") else: raise Exception(r"Error: Feature {} has no branch {}.".format(sys._getframe().f_code.co_name, branch)) self.create_project(project, version=args.version) @@ -89,6 +87,12 @@ class HarborAPI: project["configuration"]["deployment_security"], version=args.version) time.sleep(30) + @get_feature_branch + def populate_quotas(self, **kwargs): + for quotas in data["quotas"]: + self.create_project(quotas, version=args.version) + push_self_build_image_to_project(quotas["name"], args.endpoint, 'admin', 'Harbor12345', quotas["name"], "latest", size=quotas["size"]) + @get_feature_branch def create_project(self, project, **kwargs): if kwargs["branch"] == 1: @@ -98,7 +102,7 @@ class HarborAPI: body=dict(body={"project_name": project["name"], "metadata": {"public": "true"},"count_limit":project["count_limit"],"storage_limit":project["storage_limit"]}) request(url+"projects", 'post', **body) elif kwargs["branch"] == 3: - if project["registry_name"] is not None: + if project.get("registry_name") is not None: r = request(url+"registries?name="+project["registry_name"]+"", 'get') registry_id = int(str(r.json()[0]['id'])) else: @@ -106,8 +110,8 @@ class HarborAPI: body=dict(body={"project_name": project["name"], "registry_id":registry_id, "metadata": {"public": "true"},"storage_limit":project["storage_limit"]}) request(url+"projects", 'post', **body) - #Project with registry_name must have repo and to verify repo can be pulled. - if project["registry_name"] is not None: + #Project with registry_name is a proxy project, there should be images can be pulled. + if project.get("registry_name") is not None: USER_ADMIN=dict(endpoint = "https://"+args.endpoint+"/api/v2.0" , username = "admin", password = "Harbor12345") repo = Repository() for _repo in project["repo"]: @@ -644,6 +648,7 @@ def do_data_creation(): harborAPI.add_distribution(distribution, version=args.version) harborAPI.populate_projects(version=args.version) + harborAPI.populate_quotas(version=args.version) harborAPI.push_artifact_index(data["projects"][0]["name"], data["projects"][0]["artifact_index"]["name"], data["projects"][0]["artifact_index"]["tag"], version=args.version) #pull_image("busybox", "redis", "haproxy", "alpine", "httpd:2") diff --git a/tests/robot-cases/Group3-Upgrade/util.py b/tests/robot-cases/Group3-Upgrade/util.py new file mode 100644 index 000000000..c6c3b2cf3 --- /dev/null +++ b/tests/robot-cases/Group3-Upgrade/util.py @@ -0,0 +1,5 @@ +from hurry.filesize import size +from hurry.filesize import alternative + +def convert_int_to_readable_file_size(file_size): + return size(file_size, system=alternative).replace(' ', '') diff --git a/tests/robot-cases/Group3-Upgrade/verify.robot b/tests/robot-cases/Group3-Upgrade/verify.robot index c1c8f8926..e981aa339 100644 --- a/tests/robot-cases/Group3-Upgrade/verify.robot +++ b/tests/robot-cases/Group3-Upgrade/verify.robot @@ -73,8 +73,7 @@ Test Case - Upgrade Verify Run Keyword Verify Project Metadata ${data} check_content_trust=${false} #Run Keyword Verify Project Label ${data} Run Keyword Verify Member Exist ${data} - #TODO in 2.2: Modify this case when new robot account feature is ready. - #Run Keyword Verify Robot Account Exist ${data} + Run Keyword Verify Robot Account Exist ${data} Run Keyword Verify Project-level Allowlist ${data} Run Keyword Verify Webhook For 2.0 ${data} Run Keyword Verify Tag Retention Rule ${data} @@ -88,7 +87,7 @@ Test Case - Upgrade Verify Run Keyword Verify Image Tag ${data} Run Keyword Verify Trivy Is Default Scanner Run Keyword Verify Artifact Index ${data} - #Run Keyword Verify Quotas Display ${data} + Run Keyword Verify Quotas Display ${data} Test Case - Upgrade Verify [Tags] 2.1-latest @@ -98,8 +97,7 @@ Test Case - Upgrade Verify Run Keyword Verify Project Metadata ${data} check_content_trust=${false} verify_registry_name=${true} #Run Keyword Verify Project Label ${data} verify_registry_name=${true} Run Keyword Verify Member Exist ${data} verify_registry_name=${true} - ##TODO in 2.2: Modify this case when new robot account feature is ready. - #Run Keyword Verify Robot Account Exist ${data} verify_registry_name=${true} + Run Keyword Verify Robot Account Exist ${data} verify_registry_name=${true} Run Keyword Verify Project-level Allowlist ${data} verify_registry_name=${true} Run Keyword Verify Webhook For 2.0 ${data} verify_registry_name=${true} Run Keyword Verify Tag Retention Rule ${data} verify_registry_name=${true} @@ -116,4 +114,4 @@ Test Case - Upgrade Verify Run Keyword Verify Proxy Cache Image Existence ${data} Run Keyword Verify Distributions ${data} Run Keyword Verify P2P Preheat Policy ${data} - #Run Keyword Verify Quotas Display ${data} + Run Keyword Verify Quotas Display ${data}