mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 10:15:35 +01:00
Merge pull request #13882 from danfengliu/fix-nightly-keyword-issues
Add tests and fix nightly issues
This commit is contained in:
commit
d4b7888098
@ -109,12 +109,12 @@ class DockerAPI(object):
|
||||
finally:
|
||||
if expected_error_message is not None:
|
||||
if str(err_message).lower().find(expected_error_message.lower()) < 0:
|
||||
raise Exception(r" Failed to catch error [{}] when login image {}, return message: {}".format (expected_error_message, image, err_message))
|
||||
raise Exception(r" Failed to catch error [{}] when login registry {}, return message: {}".format (expected_error_message, registry, err_message))
|
||||
else:
|
||||
print(r"Docker image login got expected error message:{}".format(expected_error_message))
|
||||
else:
|
||||
if str(err_message).lower().find("error".lower()) >= 0:
|
||||
raise Exception(r" It's was not suppose to catch error when login image {}, return message is [{}]".format (image, err_message))
|
||||
raise Exception(r" It's was not suppose to catch error when login registry {}, return message is [{}]".format (registry, err_message))
|
||||
|
||||
def docker_image_pull(self, image, tag = None, expected_error_message = None):
|
||||
ret = ""
|
||||
@ -191,22 +191,23 @@ class DockerAPI(object):
|
||||
if not self.DCLIENT.images(name=baseimage):
|
||||
print( "Docker pull is triggered when building {}".format(harbor_registry))
|
||||
self.DCLIENT.pull(baseimage)
|
||||
c=self.DCLIENT.create_container(image='busybox:latest',command='dd if=/dev/urandom of=test bs=1M count=%d' % size )
|
||||
c=self.DCLIENT.create_container(image='busybox:latest',
|
||||
command='dd if=/dev/urandom of=test bs=1M count={}'.format(size))
|
||||
self.DCLIENT.start(c)
|
||||
self.DCLIENT.wait(c)
|
||||
if not tags:
|
||||
tags=['latest']
|
||||
firstrepo="%s:%s" % (harbor_registry, tags[0])
|
||||
firstrepo="{}:{}".format(harbor_registry, tags[0])
|
||||
#self.DCLIENT.commit(c, firstrepo)
|
||||
self.DCLIENT2.containers.get(c).commit(harbor_registry, tags[0])
|
||||
for tag in tags[1:]:
|
||||
repo="%s:%s" % (harbor_registry, tag)
|
||||
repo="{}:{}".format(harbor_registry, tag)
|
||||
self.DCLIENT.tag(firstrepo, repo)
|
||||
for tag in tags:
|
||||
repo="%s:%s" % (harbor_registry, tag)
|
||||
repo="{}:{}".format(harbor_registry, tag)
|
||||
ret = self.DCLIENT.push(repo)
|
||||
print("docker_image_push ret:", ret)
|
||||
print("build image %s with size %d" % (repo, size))
|
||||
print("build image {} with size {}".format(repo, size))
|
||||
self.DCLIENT.remove_image(repo)
|
||||
self.DCLIENT.remove_container(c)
|
||||
#self.DCLIENT.pull(repo)
|
||||
@ -215,7 +216,7 @@ class DockerAPI(object):
|
||||
print( "Docker image build catch exception:", str(err))
|
||||
err_message = str(err)
|
||||
if expected_error_message is None:
|
||||
raise Exception(r" Docker push image {} failed, error is [{}]".format (image, str(err)))
|
||||
raise Exception(r" Docker push image {} failed, error is [{}]".format (harbor_registry, str(err)))
|
||||
else:
|
||||
print("Docker image build did not catch exception and return message is:", ret)
|
||||
err_message = ret
|
||||
|
@ -42,19 +42,16 @@ def push_self_build_image_to_project(project_name, registry, username, password,
|
||||
_docker_api.docker_login(registry, username, password, expected_error_message = expected_login_error_message)
|
||||
|
||||
time.sleep(2)
|
||||
if expected_login_error_message != None:
|
||||
return
|
||||
|
||||
push_special_image_to_project(project_name, registry, username, password, image, tags=[tag], size=size, expected_login_error_message = expected_login_error_message, expected_error_message = expected_error_message)
|
||||
return r'{}/{}'.format(project_name, image), tag
|
||||
if expected_login_error_message in [None, ""]:
|
||||
push_special_image_to_project(project_name, registry, username, password, image, tags=[tag], size=size, expected_login_error_message = expected_login_error_message, expected_error_message = expected_error_message)
|
||||
return r'{}/{}'.format(project_name, image), tag
|
||||
|
||||
def push_special_image_to_project(project_name, registry, username, password, image, tags=None, size=1, expected_login_error_message=None, expected_error_message = None):
|
||||
_docker_api = DockerAPI()
|
||||
_docker_api.docker_login(registry, username, password, expected_error_message = expected_login_error_message)
|
||||
time.sleep(2)
|
||||
if expected_login_error_message != None:
|
||||
return
|
||||
return _docker_api.docker_image_build(r'{}/{}/{}'.format(registry, project_name, image), tags = tags, size=int(size), expected_error_message=expected_error_message)
|
||||
if expected_login_error_message in [None, ""]:
|
||||
return _docker_api.docker_image_build(r'{}/{}/{}'.format(registry, project_name, image), tags = tags, size=int(size), expected_error_message=expected_error_message)
|
||||
|
||||
|
||||
class Repository(base.Base, object):
|
||||
@ -106,6 +103,12 @@ class Repository(base.Base, object):
|
||||
base._assert_status_code(200, status_code)
|
||||
return data
|
||||
|
||||
def clear_repositories(self, project_name, **kwargs):
|
||||
repos = self.list_repositories(project_name, **kwargs)
|
||||
print("Repos to be cleared:", repos)
|
||||
for repo in repos:
|
||||
self.delete_repository(project_name, repo.name.split('/')[1])
|
||||
|
||||
def get_repository(self, project_name, repo_name, **kwargs):
|
||||
client = self._get_client(**kwargs)
|
||||
data, status_code, _ = client.get_repository_with_http_info(project_name, repo_name)
|
||||
|
@ -71,7 +71,7 @@ class TestCNAB(unittest.TestCase):
|
||||
|
||||
#3. Push bundle to harbor as repository(RA);
|
||||
target = harbor_server + "/" + TestCNAB.project_name + "/" + TestCNAB.cnab_repo_name + ":" + TestCNAB.cnab_tag
|
||||
TestCNAB.reference_sha256 = library.cnab.push_cnab_bundle(harbor_server, TestCNAB.user_name, TestCNAB.user_push_cnab_password, "photon:latest", "kong:latest", target)
|
||||
TestCNAB.reference_sha256 = library.cnab.push_cnab_bundle(harbor_server, TestCNAB.user_name, TestCNAB.user_push_cnab_password, "containrrr/watchtower:latest", "kong:latest", target)
|
||||
|
||||
#4. Get repository from Harbor successfully;
|
||||
TestCNAB.cnab_bundle_data = TestCNAB.repo.get_repository(TestCNAB.project_name, TestCNAB.cnab_repo_name, **TestCNAB.USER_CLIENT)
|
||||
|
@ -19,7 +19,6 @@ from library.chart import Chart
|
||||
import library.helm
|
||||
import base
|
||||
import v2_swagger_client
|
||||
|
||||
class TestRobotAccount(unittest.TestCase):
|
||||
@suppress_urllib3_warning
|
||||
def setUp(self):
|
||||
@ -145,13 +144,14 @@ class TestRobotAccount(unittest.TestCase):
|
||||
else:
|
||||
push_self_build_image_to_project(project_access["project_name"], harbor_server, system_ra_client["username"], system_ra_client["password"], "test_unpushable"+base._random_name("repo"), "v6.8.1"+base._random_name("tag"), expected_error_message = "unauthorized to access repository")
|
||||
|
||||
def verify_repository_unpushable(self, project_access_list, system_ra_client, expected_login_error_message = "unauthorized: authentication required"):
|
||||
def verify_repository_unpushable(self, project_access_list, system_ra_client, expected_login_error_message = "unauthorized: authentication required", expected_error_message = ""):
|
||||
for project_access in project_access_list: #---repository:push---
|
||||
push_self_build_image_to_project(
|
||||
project_access["project_name"],
|
||||
harbor_server, system_ra_client["username"], system_ra_client["password"],
|
||||
"test_unpushable"+base._random_name("repo"), "v6.8.1"+base._random_name("tag"),
|
||||
expected_login_error_message = expected_login_error_message
|
||||
expected_login_error_message = expected_login_error_message,
|
||||
expected_error_message = expected_error_message
|
||||
)
|
||||
|
||||
def test_02_SystemlevelRobotAccount(self):
|
||||
@ -162,7 +162,7 @@ class TestRobotAccount(unittest.TestCase):
|
||||
1. Define a number of access lists;
|
||||
2. Create the same number of private projects;
|
||||
3. Create a system robot account has permission for those projects;
|
||||
4. Verify the system robot account has the corresponding rights;
|
||||
4. Verify the system robot account has all the corresponding rights;
|
||||
5. Disable the system robot account;
|
||||
6. Verify the system robot account has no the corresponding rights;
|
||||
7. Enable the system robot account;
|
||||
@ -171,12 +171,15 @@ class TestRobotAccount(unittest.TestCase):
|
||||
10. Verify the system robot account has no the corresponding right with the old secret already;
|
||||
11. Verify the system robot account still has the corresponding right with the new secret;
|
||||
12. List system robot account, then add a new project to the system robot account project permission list;
|
||||
13. Delete this project;
|
||||
14. List system robot account successfully;
|
||||
15. Delete the system robot account;
|
||||
16. Verify the system robot account has no the corresponding right;
|
||||
17. Add a system robot account with all project coverd;
|
||||
18. Verify the system robot account has no the corresponding right;
|
||||
13. Verify the system robot account has the corresponding right for this new project;
|
||||
14. Edit the system robot account as removing this new project from it;
|
||||
15. Verify the system robot account has no the corresponding right for this new project;
|
||||
16. Delete this project;
|
||||
17. List system robot account successfully;
|
||||
18. Delete the system robot account;
|
||||
19. Verify the system robot account has no the corresponding right;
|
||||
20. Add a system robot account with all project coverd;
|
||||
21. Verify the system robot account has no the corresponding right;
|
||||
"""
|
||||
#1. Define a number of access lists;
|
||||
CHART_FILE_LIST = [dict(name = 'prometheus', version='7.0.2'), dict(name = 'harbor', version='0.2.0')]
|
||||
@ -210,7 +213,7 @@ class TestRobotAccount(unittest.TestCase):
|
||||
SYSTEM_RA_CLIENT = dict(endpoint = TestRobotAccount.url, username = system_robot_account.name, password = system_robot_account.secret)
|
||||
SYSTEM_RA_CHART_CLIENT = dict(endpoint = CHART_API_CLIENT["endpoint"], username = SYSTEM_RA_CLIENT["username"], password = SYSTEM_RA_CLIENT["password"])
|
||||
|
||||
#4. Verify the system robot account has the corresponding rights;
|
||||
#4. Verify the system robot account has all the corresponding rights;
|
||||
for project_access in project_access_list:
|
||||
print(r"project_access:", project_access)
|
||||
if project_access["check_list"][1]: #---repository:push---
|
||||
@ -303,26 +306,44 @@ class TestRobotAccount(unittest.TestCase):
|
||||
self.robot.update_system_robot_account(system_robot_account_id, system_robot_account.name, robot_account_Permissions_list, **ADMIN_CLIENT)
|
||||
self.robot.list_robot(**ADMIN_CLIENT)
|
||||
|
||||
#13. Delete this project;
|
||||
self.project.delete_project(project_for_del_id, **ADMIN_CLIENT)
|
||||
#13. Verify the system robot account has the corresponding right for this new project;
|
||||
project_access_list.append(dict(project_name = project_for_del_name, project_id = project_for_del_id, check_list = [True] * 10))
|
||||
self.verify_repository_pushable(project_access_list, SYSTEM_RA_CLIENT)
|
||||
|
||||
#14. List system robot account successfully;
|
||||
#14. Edit the system robot account as removing this new project from it;
|
||||
robot_account_Permissions_list.remove(robot_account_Permissions)
|
||||
self.robot.update_system_robot_account(system_robot_account_id, system_robot_account.name, robot_account_Permissions_list, **ADMIN_CLIENT)
|
||||
self.robot.list_robot(**ADMIN_CLIENT)
|
||||
|
||||
#15. Delete the system robot account;
|
||||
#15. Verify the system robot account has no the corresponding right for this new project;
|
||||
project_access_list_for_del = [dict(project_name = project_for_del_name, project_id = project_for_del_id, check_list = [True] * 10)]
|
||||
self.verify_repository_unpushable(
|
||||
project_access_list_for_del, SYSTEM_RA_CLIENT,
|
||||
expected_login_error_message = "",
|
||||
expected_error_message = "action: push: unauthorized to access repository"
|
||||
)
|
||||
|
||||
#16. Delete this project;
|
||||
self.repo.clear_repositories(project_for_del_name, **ADMIN_CLIENT)
|
||||
self.project.delete_project(project_for_del_id, **ADMIN_CLIENT)
|
||||
|
||||
#17. List system robot account successfully;
|
||||
self.robot.list_robot(**ADMIN_CLIENT)
|
||||
|
||||
#18. Delete the system robot account;
|
||||
self.robot.delete_robot_account(system_robot_account_id, **ADMIN_CLIENT)
|
||||
|
||||
#16. Verify the system robot account has no the corresponding right;
|
||||
#19. Verify the system robot account has no the corresponding right;
|
||||
self.verify_repository_unpushable(project_access_list, SYSTEM_RA_CLIENT)
|
||||
|
||||
#17. Add a system robot account with all project coverd;
|
||||
#20. Add a system robot account with all project coverd;
|
||||
all_true_access_list= self.robot.create_access_list( [True] * 10 )
|
||||
robot_account_Permissions_list = []
|
||||
robot_account_Permissions = v2_swagger_client.Permission(kind = "project", namespace = "*", access = all_true_access_list)
|
||||
robot_account_Permissions_list.append(robot_account_Permissions)
|
||||
_, system_robot_account_cover_all = self.robot.create_system_robot(robot_account_Permissions_list, 300)
|
||||
|
||||
#18. Verify the system robot account has no the corresponding right;
|
||||
#21. Verify the system robot account has no the corresponding right;
|
||||
print("system_robot_account_cover_all:", system_robot_account_cover_all)
|
||||
SYSTEM_RA_CLIENT_COVER_ALL = dict(endpoint = TestRobotAccount.url, username = system_robot_account_cover_all.name, password = system_robot_account_cover_all.secret)
|
||||
projects = self.project.get_projects(dict(), **ADMIN_CLIENT)
|
||||
|
@ -2,7 +2,9 @@ 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.5 Add support for e2e py-test
|
||||
# V 2.5 Add support for e2e py-test (especially containerd)
|
||||
# V 2.6 upgrade helm2, helm3 and docker 20.10.0
|
||||
# V 2.6.1 upgrade helm2, helm3 and docker 20.10.1
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends wget curl gnupg2
|
||||
RUN apt-get install libseccomp2
|
||||
@ -87,8 +89,9 @@ RUN wget https://storage.googleapis.com/cri-containerd-release/cri-containerd-${
|
||||
tar --no-overwrite-dir -C / -xzf cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz
|
||||
|
||||
# Install docker, docker compose
|
||||
RUN wget https://download.docker.com/linux/static/stable/x86_64/docker-19.03.12.tgz && \
|
||||
tar --strip-components=1 -xvzf docker-19.03.12.tgz -C /usr/bin && \
|
||||
ENV DOCKER_VERSION 20.10.1
|
||||
RUN wget https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_VERSION.tgz && \
|
||||
tar --strip-components=1 -xvzf docker-$DOCKER_VERSION.tgz -C /usr/bin && \
|
||||
curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
@ -104,14 +107,14 @@ RUN set -x \
|
||||
RUN curl -sSL https://github.com/vmware/govmomi/releases/download/v0.16.0/govc_linux_amd64.gz | gzip -d > /usr/local/bin/govc && \
|
||||
chmod +x /usr/local/bin/govc
|
||||
|
||||
RUN wget https://get.helm.sh/helm-v2.14.1-linux-386.tar.gz && tar zxvf helm-v2.14.1-linux-386.tar.gz && \
|
||||
cp linux-386/helm /usr/local/bin/helm && \
|
||||
cp linux-386/helm /usr/local/bin/helm2 && \
|
||||
helm init --client-only && \
|
||||
RUN wget https://get.helm.sh/helm-v2.16.12-linux-amd64.tar.gz && tar zxvf helm-v2.16.12-linux-amd64.tar.gz && \
|
||||
cp linux-amd64/helm /usr/local/bin/helm && \
|
||||
cp linux-amd64/helm /usr/local/bin/helm2 && \
|
||||
helm init --stable-repo-url https://charts.helm.sh/stable --client-only && \
|
||||
helm plugin install https://github.com/chartmuseum/helm-push
|
||||
|
||||
RUN wget https://get.helm.sh/helm-v3.0.0-linux-386.tar.gz && tar zxvf helm-v3.0.0-linux-386.tar.gz && \
|
||||
mv linux-386/helm /usr/local/bin/helm3 && \
|
||||
RUN wget https://get.helm.sh/helm-v3.3.3-linux-amd64.tar.gz && tar zxvf helm-v3.3.3-linux-amd64.tar.gz && \
|
||||
mv linux-amd64/helm /usr/local/bin/helm3 && \
|
||||
helm3 plugin install https://github.com/chartmuseum/helm-push
|
||||
|
||||
RUN curl -LO https://github.com/deislabs/oras/releases/download/v0.8.1/oras_0.8.1_linux_amd64.tar.gz && \
|
||||
|
@ -54,8 +54,10 @@ Push image
|
||||
Wait Unitl Command Success docker push ${ip}/${project}/${image_in_use_with_tag}
|
||||
Wait Unitl Command Success docker logout ${ip}
|
||||
#Remove image for docker 20
|
||||
Wait Unitl Command Success docker rmi -f ${ip}/${project}/${image_in_use_with_tag}
|
||||
Run Keyword If ${need_pull_first}==${true} Wait Unitl Command Success docker rmi -f ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image_in_use}
|
||||
${output}= Wait Unitl Command Success docker rmi -f ${ip}/${project}/${image_in_use_with_tag}
|
||||
Log All Docker rmi: ${output}
|
||||
${output}= Run Keyword If ${need_pull_first}==${true} Wait Unitl Command Success docker rmi -f ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image_in_use}
|
||||
Log All Docker rmi: ${output}
|
||||
Sleep 1
|
||||
|
||||
Push Image With Tag
|
||||
@ -193,8 +195,7 @@ Docker Login
|
||||
Docker Pull
|
||||
[Arguments] ${image}
|
||||
${output}= Retry Keyword N Times When Error 2 Wait Unitl Command Success docker pull ${image}
|
||||
Log ${output}
|
||||
Log To Console Docker Pull: ${output}
|
||||
Log All Docker Pull: ${output}
|
||||
[Return] ${output}
|
||||
|
||||
Docker Tag
|
||||
|
@ -296,11 +296,22 @@ Delete A Label
|
||||
|
||||
## Garbage Collection
|
||||
Switch To Garbage Collection
|
||||
Switch To Configure
|
||||
Sleep 1
|
||||
Retry Element Click xpath=${gc_config_page}
|
||||
Wait Until Page Contains Element ${garbage_collection_xpath}
|
||||
Retry Element Click xpath=${garbage_collection_xpath}
|
||||
|
||||
Set GC Schedule
|
||||
[Arguments] ${type} ${value}=${null}
|
||||
Switch To Garbage Collection
|
||||
Retry Double Keywords When Error Retry Element Click ${GC_schedule_edit_btn} Retry Wait Until Page Not Contains Element ${GC_schedule_edit_btn}
|
||||
Retry Element Click ${GC_schedule_select}
|
||||
Run Keyword If '${type}'=='custom' Run Keywords Retry Element Click ${vulnerability_dropdown_list_item_custom} AND Retry Text Input ${targetCron_id} ${value}
|
||||
... ELSE Retry Element Click ${vulnerability_dropdown_list_item_none}
|
||||
Retry Double Keywords When Error Retry Element Click ${GC_schedule_save_btn} Retry Wait Until Page Not Contains Element ${GC_schedule_save_btn}
|
||||
Capture Page Screenshot
|
||||
|
||||
Click GC Now
|
||||
Sleep 1
|
||||
Retry Element Click xpath=${gc_now_xpath}
|
||||
|
@ -62,4 +62,8 @@ ${distribution_edit_btn_id} //*[@id='distribution-edit']
|
||||
${filter_dist_btn} //hbr-filter//clr-icon[contains(@class,'search-btn')]
|
||||
${filter_dist_input} //hbr-filter//input
|
||||
|
||||
${GC_schedule_edit_btn} //*[@id='editSchedule']
|
||||
${GC_schedule_select} //*[@id='selectPolicy']
|
||||
${GC_schedule_save_btn} //*[@id='config-save']
|
||||
|
||||
|
||||
|
@ -39,7 +39,15 @@ Retry GC Should Be Successful
|
||||
GC Should Be Successful
|
||||
[Arguments] ${history_id} ${expected_msg}
|
||||
${rc} ${output}= Run And Return Rc And Output curl -u ${HARBOR_ADMIN}:${HARBOR_PASSWORD} -i --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/system/gc/${history_id}/log"
|
||||
Log To Console ${output}
|
||||
Log All ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
Run Keyword If '${expected_msg}' != '${null}' Should Contain ${output} ${expected_msg}
|
||||
Should Contain ${output} success to run gc in job.
|
||||
Should Contain ${output} success to run gc in job.
|
||||
|
||||
Get GC Logs
|
||||
[Arguments]
|
||||
${cmd}= Set Variable curl -u ${HARBOR_ADMIN}:${HARBOR_PASSWORD} -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/system/gc"
|
||||
Log All cmd:${cmd}
|
||||
${rc} ${output}= Run And Return Rc And Output ${cmd}
|
||||
Log All ${output}
|
||||
[Return] ${output}
|
@ -63,6 +63,10 @@ Search Project Member
|
||||
Change Project Member Role
|
||||
[Arguments] ${project} ${user} ${role}
|
||||
Retry Element Click xpath=//clr-dg-cell//a[contains(.,'${project}')]
|
||||
Change Member Role ${user} ${role}
|
||||
|
||||
Change Member Role
|
||||
[Arguments] ${user} ${role}
|
||||
Retry Element Click xpath=${project_member_tag_xpath}
|
||||
Retry Element Click xpath=//project-detail//clr-dg-row[contains(.,'${user}')]//clr-checkbox-wrapper
|
||||
#change role
|
||||
@ -133,12 +137,16 @@ Manage Project Member
|
||||
[Arguments] ${admin} ${pwd} ${project} ${user} ${op} ${has_image}=${true} ${is_oidc_mode}=${false}
|
||||
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${admin} ${pwd}
|
||||
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${admin}
|
||||
Manage Project Member Without Sign In ${project} ${user} ${op} has_image=${has_image}
|
||||
Logout Harbor
|
||||
|
||||
Manage Project Member Without Sign In
|
||||
[Arguments] ${project} ${user} ${op} ${has_image}=${true}
|
||||
Go Into Project ${project} ${has_image}
|
||||
Switch To Member
|
||||
Run Keyword If '${op}' == 'Add' Add Guest Member To Project ${user}
|
||||
... ELSE IF '${op}' == 'Remove' Delete Project Member ${user}
|
||||
... ELSE Change Project Member Role ${project} ${user} ${role}
|
||||
Logout Harbor
|
||||
|
||||
Change User Role In Project
|
||||
[Arguments] ${admin} ${pwd} ${project} ${user} ${role} ${is_oidc_mode}=${false}
|
||||
@ -193,14 +201,14 @@ User Should Be Admin
|
||||
Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v2
|
||||
|
||||
User Should Be Maintainer
|
||||
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
|
||||
[Arguments] ${user} ${pwd} ${project} ${image} ${is_oidc_mode}=${false}
|
||||
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
|
||||
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
|
||||
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
|
||||
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
|
||||
Project Should Display ${project}
|
||||
Go Into Project ${project}
|
||||
Delete Repo ${project}
|
||||
Delete Repo ${project} ${image}
|
||||
Switch To Member
|
||||
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Maintainer')]
|
||||
Logout Harbor
|
||||
|
@ -122,13 +122,31 @@ Make Project Public
|
||||
Switch To Project Configuration
|
||||
Retry Checkbox Should Be Selected ${project_config_public_checkbox}
|
||||
|
||||
Repo Exist
|
||||
[Arguments] ${pro_name} ${repo_name}
|
||||
Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${pro_name}/${repo_name}')]
|
||||
|
||||
Repo Not Exist
|
||||
[Arguments] ${pro_name} ${repo_name}
|
||||
Retry Wait Until Page Not Contains Element //clr-dg-row[contains(.,'${pro_name}/${repo_name}')]
|
||||
|
||||
Filter Repo
|
||||
[Arguments] ${pro_name} ${repo_name} ${exsit}=${true}
|
||||
Retry Double Keywords When Error Retry Element Click ${filter_dist_btn} Wait Until Element Is Visible And Enabled ${filter_dist_input}
|
||||
Retry Clear Element Text ${filter_dist_input}
|
||||
Retry Text Input ${filter_dist_input} ${pro_name}/${repo_name}
|
||||
Run Keyword If ${exsit}==${true} Repo Exist ${pro_name} ${repo_name}
|
||||
... ELSE Repo Not Exist ${pro_name} ${repo_name}
|
||||
|
||||
Delete Repo
|
||||
[Arguments] ${projectname}
|
||||
${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label
|
||||
[Arguments] ${pro_name} ${repo_name}
|
||||
${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,'${pro_name}/${repo_name}')]//clr-checkbox-wrapper//label
|
||||
Filter Repo ${pro_name} ${repo_name}
|
||||
Retry Double Keywords When Error Retry Element Click ${element_repo_checkbox} Wait Until Element Is Visible And Enabled ${repo_delete_btn}
|
||||
Retry Double Keywords When Error Retry Element Click ${repo_delete_btn} Wait Until Element Is Visible And Enabled ${delete_confirm_btn}
|
||||
Retry Double Keywords When Error Retry Element Click ${delete_confirm_btn} Retry Wait Until Page Not Contains Element ${delete_confirm_btn}
|
||||
Retry Wait Until Page Not Contains Element ${element_repo_checkbox}
|
||||
Filter Repo ${pro_name} ${repo_name} exsit=${false}
|
||||
|
||||
Delete Repo on CardView
|
||||
[Arguments] ${reponame}
|
||||
@ -217,11 +235,11 @@ Go Into Repo
|
||||
${out} Run Keyword And Ignore Error Retry Wait Until Page Contains Element ${repo_name_element}
|
||||
Sleep 2
|
||||
Continue For Loop If '${out[0]}'=='FAIL'
|
||||
${out} Retry Click Repo Name ${repo_name_element}
|
||||
Retry Click Repo Name ${repo_name_element}
|
||||
Sleep 2
|
||||
Exit For Loop
|
||||
END
|
||||
|
||||
Should Be Equal As Strings '${out[0]}' 'PASS'
|
||||
|
||||
Click Index Achieve
|
||||
[Arguments] ${tag_name}
|
||||
@ -295,34 +313,41 @@ Filter Labels In Tags
|
||||
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${labelName2}')]
|
||||
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${labelName1}')]
|
||||
|
||||
Get Statics
|
||||
[Arguments] ${locator}
|
||||
Reload Page
|
||||
Sleep 5
|
||||
${privaterepo}= Get Text ${locator}
|
||||
[Return] ${privaterepo}
|
||||
|
||||
Retry Get Statics
|
||||
[Arguments] ${locator}
|
||||
@{param} Create List ${locator}
|
||||
${ret}= Retry Keyword N Times When Error 3 Get Statics @{param}
|
||||
[Return] ${ret}
|
||||
|
||||
Get Statics Private Repo
|
||||
${privaterepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1]
|
||||
Convert To Integer ${privaterepo}
|
||||
${privaterepo}= Retry Get Statics //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1]
|
||||
[Return] ${privaterepo}
|
||||
|
||||
Get Statics Private Project
|
||||
${privateproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[1]/statistics/div/span[1]
|
||||
Convert To Integer ${privateproj}
|
||||
${privateproj}= Retry Get Statics //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[1]/statistics/div/span[1]
|
||||
[Return] ${privateproj}
|
||||
|
||||
Get Statics Public Repo
|
||||
${publicrepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[2]/statistics/div/span[1]
|
||||
Convert To Integer ${publicrepo}
|
||||
${publicrepo}= Retry Get Statics //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[2]/statistics/div/span[1]
|
||||
[Return] ${publicrepo}
|
||||
|
||||
Get Statics Public Project
|
||||
${publicproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[1]/statistics/div/span[1]
|
||||
Convert To Integer ${publicproj}
|
||||
${publicproj}= Retry Get Statics //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[1]/statistics/div/span[1]
|
||||
[Return] ${publicproj}
|
||||
|
||||
Get Statics Total Repo
|
||||
${totalrepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[2]/statistics/div/span[1]
|
||||
Convert To Integer ${totalrepo}
|
||||
${totalrepo}= Retry Get Statics //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[2]/statistics/div/span[1]
|
||||
[Return] ${totalrepo}
|
||||
|
||||
Get Statics Total Project
|
||||
${totalproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[1]/statistics/div/span[1]
|
||||
Convert To Integer ${totalproj}
|
||||
${totalproj}= Retry Get Statics //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[1]/statistics/div/span[1]
|
||||
[Return] ${totalproj}
|
||||
|
||||
Input Count Quota
|
||||
|
@ -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
|
||||
[Arguments] ${project} ${image} ${period}=60 ${times}=3 ${tag}=${null} ${expected_image_size_in_regexp}=${null}
|
||||
FOR ${n} IN RANGE 0 ${times}
|
||||
Sleep ${period}
|
||||
Go Into Project ${project}
|
||||
@ -242,6 +242,9 @@ Image Should Be Replicated To Project
|
||||
END
|
||||
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
|
||||
Should Be Equal As Strings '${out[0]}' 'PASS'
|
||||
Go Into Repo ${project}/${image}
|
||||
${size}= Run Keyword If '${tag}'!='${null}' and '${expected_image_size_in_regexp}'!='${null}' Get Text //clr-dg-row[contains(., '${tag}')]//clr-dg-cell[4]/div
|
||||
Run Keyword If '${tag}'!='${null}' and '${expected_image_size_in_regexp}'!='${null}' Should Match Regexp '${size}' '${expected_image_size_in_regexp}'
|
||||
|
||||
Executions Result Count Should Be
|
||||
[Arguments] ${expected_status} ${expected_trigger_type} ${expected_result_count}
|
||||
|
@ -337,6 +337,7 @@ Verify Replicationrule
|
||||
Log To Console -----replicationrule-----"${replicationrule}"------------
|
||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
Edit Replication Rule ${replicationrule}
|
||||
Capture Page Screenshot
|
||||
@{is_src_registry}= Get Value From Json ${json} $.replicationrule[?(@.rulename=${replicationrule})].is_src_registry
|
||||
@{trigger_type}= Get Value From Json ${json} $.replicationrule[?(@.rulename=${replicationrule})].trigger_type
|
||||
@{name_filters}= Get Value From Json ${json} $.replicationrule[?(@.rulename=${replicationrule})].name_filters
|
||||
@ -365,6 +366,11 @@ Verify Replicationrule
|
||||
Run Keyword If '@{trigger_type}[0]' == 'scheduled' Log To Console ----------@{trigger_type}[0]------------
|
||||
Run Keyword If '@{trigger_type}[0]' == 'scheduled' Retry Textfield Value Should Be ${targetCron_id} @{cron}[0]
|
||||
END
|
||||
|
||||
Reload Page
|
||||
FOR ${replicationrule} IN @{replicationrules}
|
||||
Delete Replication Rule ${replicationrule}
|
||||
END
|
||||
Close Browser
|
||||
|
||||
Verify Interrogation Services
|
||||
@ -536,4 +542,21 @@ Loop P2P Preheat Policys
|
||||
FOR ${policy} IN @{policy_names}
|
||||
${provider_name}= Get Value From Json ${json} $.projects[?(@.name=${project})].p2p_preheat_policy[?(@.name=${policy})].provider_name
|
||||
Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${policy}') and contains(.,'${provider_name}[0]')]
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
Verify Quotas Display
|
||||
[Arguments] ${json}
|
||||
Log To Console "Verify Quotas Display..."
|
||||
@{project}= Get Value From Json ${json} $.projects.[*].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]
|
||||
END
|
||||
Close Browser
|
@ -18,8 +18,8 @@ Documentation This resource provides any keywords related to the Harbor private
|
||||
*** Variables ***
|
||||
${vulnerability_edit_btn} xpath=//vulnerability-config//cron-selection//button[contains(.,'EDIT')]
|
||||
${vulnerability_dropdown_list} xpath=//vulnerability-config//cron-selection//select[@id='selectPolicy']
|
||||
${vulnerability_dropdown_list_item_none} xpath=//vulnerability-config//cron-selection//select[@id='selectPolicy']//option[contains(.,'None')]
|
||||
${vulnerability_dropdown_list_item_custom} xpath=//vulnerability-config//cron-selection//select[@id='selectPolicy']//option[contains(.,'Custom')]
|
||||
${vulnerability_dropdown_list_item_none} xpath=//select[@id='selectPolicy']//option[contains(.,'None')]
|
||||
${vulnerability_dropdown_list_item_custom} xpath=//select[@id='selectPolicy']//option[contains(.,'Custom')]
|
||||
${vulnerability_save_btn} xpath=//cron-selection//button[contains(.,'SAVE')]
|
||||
${scan_now_button} //vulnerability-config//button[contains(.,'NOW')]
|
||||
${vulnerability_page} //clr-vertical-nav-group-children/a[contains(.,'Vulnerability')]
|
||||
|
@ -174,19 +174,21 @@ Delete A Project Without Sign In Harbor
|
||||
[Arguments] ${harbor_ip}=${ip} ${username}=${HARBOR_ADMIN} ${password}=${HARBOR_PASSWORD}
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
${project_name}= Set Variable 000${d}
|
||||
${image}= Set Variable hello-world
|
||||
Create An New Project And Go Into Project ${project_name}
|
||||
Push Image ${harbor_ip} ${username} ${password} ${project_name} hello-world
|
||||
Push Image ${harbor_ip} ${username} ${password} ${project_name} ${image}
|
||||
Project Should Not Be Deleted ${project_name}
|
||||
Go Into Project ${project_name}
|
||||
Delete Repo ${project_name}
|
||||
Delete Repo ${project_name} ${image}
|
||||
Navigate To Projects
|
||||
Project Should Be Deleted ${project_name}
|
||||
|
||||
Manage Project Member Without Sign In Harbor
|
||||
[Arguments] ${sign_in_user} ${sign_in_pwd} ${test_user1}=user005 ${test_user2}=user006 ${is_oidc_mode}=${false}
|
||||
${d}= Get current Date result_format=%m%s
|
||||
${image}= Set Variable hello-world
|
||||
Create An New Project And Go Into Project project${d}
|
||||
Push image ${ip} ${sign_in_user} ${sign_in_pwd} project${d} hello-world
|
||||
Push image ${ip} ${sign_in_user} ${sign_in_pwd} project${d} ${image}
|
||||
Logout Harbor
|
||||
|
||||
User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
|
||||
@ -197,7 +199,7 @@ Manage Project Member Without Sign In Harbor
|
||||
Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Admin is_oidc_mode=${is_oidc_mode}
|
||||
User Should Be Admin ${test_user1} ${sign_in_pwd} project${d} ${test_user2} is_oidc_mode=${is_oidc_mode}
|
||||
Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Maintainer is_oidc_mode=${is_oidc_mode}
|
||||
User Should Be Maintainer ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
|
||||
User Should Be Maintainer ${test_user1} ${sign_in_pwd} project${d} ${image} is_oidc_mode=${is_oidc_mode}
|
||||
Manage Project Member ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Remove is_oidc_mode=${is_oidc_mode}
|
||||
User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
|
||||
Push image ${ip} ${sign_in_user} ${sign_in_pwd} project${d} hello-world
|
||||
@ -315,7 +317,7 @@ Body Of Verfiy Project Level CVE Allowlist By Quick Way of Add System
|
||||
Close Browser
|
||||
|
||||
Body Of Replication Of Push Images to Registry Triggered By Event
|
||||
[Arguments] ${provider} ${endpoint} ${username} ${pwd} ${dest_namespace}
|
||||
[Arguments] ${provider} ${endpoint} ${username} ${pwd} ${dest_namespace} ${image_size}=12
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
${sha256}= Set Variable 0e67625224c1da47cb3270e7a861a83e332f708d3d89dde0cbed432c94824d9a
|
||||
@ -329,7 +331,7 @@ Body Of Replication Of Push Images to Registry Triggered By Event
|
||||
Create A New Endpoint ${provider} e${d} ${endpoint} ${username} ${pwd} Y
|
||||
Switch To Replication Manage
|
||||
Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} ${dest_namespace} mode=Event Based del_remote=${true}
|
||||
Push Special Image To Project project${d} ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${image} tags=@{tags} size=12
|
||||
Push Special Image To Project project${d} ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${image} tags=@{tags} size=${image_size}
|
||||
Filter Replication Rule rule${d}
|
||||
Select Rule rule${d}
|
||||
${endpoint_body}= Fetch From Right ${endpoint} //
|
||||
@ -337,7 +339,7 @@ Body Of Replication Of Push Images to Registry Triggered By Event
|
||||
Run Keyword If '${provider}'=='docker-hub' or '${provider}'=='gitlab' Docker Image Can Be Pulled ${dest_namespace}/${image}:${tag1} times=3
|
||||
Executions Result Count Should Be Succeeded event_based 1
|
||||
Go Into Project project${d}
|
||||
Delete Repo project${d}
|
||||
Delete Repo project${d} ${image}
|
||||
Run Keyword If '${provider}'=='docker-hub' or '${provider}'=='gitlab' Docker Image Can Not Be Pulled ${dest_namespace}/${image}:${tag1}
|
||||
Switch To Replication Manage
|
||||
Filter Replication Rule rule${d}
|
||||
|
@ -1,4 +1,4 @@
|
||||
f# Copyright Project Harbor Authors
|
||||
# Copyright Project Harbor Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -287,3 +287,8 @@ Run Curl And Return Json
|
||||
Create File ${json_data_file} ${output}
|
||||
${json}= Load Json From File ${json_data_file}
|
||||
[Return] ${json}
|
||||
|
||||
Log All
|
||||
[Arguments] ${text}
|
||||
Log To Console ${text}
|
||||
Log ${text}
|
||||
|
@ -31,7 +31,7 @@ Test Case - Registry Basic Verfication
|
||||
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}
|
||||
Delete Repo project${d} busybox
|
||||
|
||||
Close Browser
|
||||
|
||||
|
@ -222,6 +222,7 @@ Test Case - User View Projects
|
||||
Close Browser
|
||||
|
||||
Test Case - User View Logs
|
||||
[tags] user_view_logs
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
${img}= Set Variable kong
|
||||
@ -234,7 +235,7 @@ Test Case - User View Logs
|
||||
Pull image ${ip} user002 Test1@34 project${d} ${img}:${tag}
|
||||
|
||||
Go Into Project project${d}
|
||||
Delete Repo project${d}
|
||||
Delete Repo project${d} ${img}
|
||||
|
||||
Sleep 3
|
||||
|
||||
@ -482,7 +483,7 @@ Test Case - Project Storage Quotas Dispaly And Control
|
||||
Should Be Equal As Strings ${storage_quota_ret} ${image_b_size} of ${storage_quota}${storage_quota_unit}
|
||||
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a}:${image_a_ver} err_msg=adding 330.1 MiB of storage resource, which when updated to current usage of err_msg_2=MiB will exceed the configured upper limit of ${storage_quota}.0 MiB
|
||||
Go Into Project project${d}
|
||||
Delete Repo project${d}/${image_b}
|
||||
Delete Repo project${d} ${image_b}
|
||||
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a} tag=${image_a_ver} tag1=${image_a_ver}
|
||||
${storage_quota_ret}= Get Project Storage Quota Text From Project Quotas List project${d}
|
||||
${storage_quota_ret_str_left} Fetch From Left ${storage_quota_ret} 25.
|
||||
@ -696,28 +697,34 @@ Test Case - Read Only Mode
|
||||
Close Browser
|
||||
|
||||
Test Case - Proxy Cache
|
||||
[Tags] run-once
|
||||
[Tags] run-once proxy_cache
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
${registry}= Set Variable https://hub.docker.com/
|
||||
${user_namespace}= Set Variable ${DOCKER_USER}
|
||||
${registry}= Set Variable https://cicd.harbor.vmwarecna.net
|
||||
${user_namespace}= Set Variable nightly
|
||||
${image}= Set Variable for_proxy
|
||||
${tag}= Set Variable 1.0
|
||||
${manifest_index}= Set Variable index081597864867
|
||||
${manifest_tag}= Set Variable index_tag081597864867
|
||||
${test_user}= Set Variable user010
|
||||
${test_pwd}= Set Variable Test1@34
|
||||
Init Chrome Driver
|
||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
Switch To Registries
|
||||
Create A New Endpoint docker-hub e1${d} ${registry} ${user_namespace} ${DOCKER_PWD}
|
||||
Create A New Endpoint harbor e1${d} ${registry} ${null} ${null}
|
||||
Create An New Project And Go Into Project project${d} proxy_cache=${true} registry=e1${d}
|
||||
Manage Project Member Without Sign In project${d} ${test_user} Add has_image=${false}
|
||||
Go Into Project project${d} has_image=${false}
|
||||
Change Member Role ${test_user} Developer
|
||||
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox:latest err_msg=can not push artifact to a proxy project
|
||||
Cannot Push image ${ip} ${test_user} ${test_pwd} project${d} busybox:latest err_msg=can not push artifact to a proxy project
|
||||
Pull Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${user_namespace}/${image} tag=${tag}
|
||||
Pull Image ${ip} ${test_user} ${test_pwd} project${d} ${user_namespace}/${manifest_index} tag=${manifest_tag}
|
||||
Log To Console Start to Sleep 3 minitues......
|
||||
Sleep 180
|
||||
Go Into Project project${d}
|
||||
Go Into Repo project${d}/${user_namespace}/${image}
|
||||
Pull Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${user_namespace}/${manifest_index} tag=${manifest_tag}
|
||||
Log To Console Start to Sleep 10 minitues......
|
||||
Sleep 600
|
||||
Sleep 500
|
||||
Go Into Project project${d}
|
||||
Go Into Repo project${d}/${user_namespace}/${manifest_index}
|
||||
Go Into Index And Contain Artifacts ${manifest_tag} limit=1
|
||||
|
@ -33,7 +33,7 @@ Test Case - Garbage Collection
|
||||
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} redis
|
||||
Sleep 2
|
||||
Go Into Project project${d}
|
||||
Delete Repo project${d}
|
||||
Delete Repo project${d} redis
|
||||
Sleep 2
|
||||
GC Now ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
Retry GC Should Be Successful 1 7 blobs and 1 manifests eligible for deletion
|
||||
|
@ -215,6 +215,11 @@ Test Case - Replication Of Push Chart from Self To Harbor
|
||||
Test Case - Replication Of Push Images from Self To Harbor By Push Event
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
${image}= Set Variable test_large_image
|
||||
${image_size}= Set Variable 4096
|
||||
${tag1}= Set Variable large_f
|
||||
@{tags} Create List ${tag1}
|
||||
|
||||
#login source
|
||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
Create An New Project And Go Into Project project${d}
|
||||
@ -227,8 +232,9 @@ Test Case - Replication Of Push Images from Self To Harbor By Push Event
|
||||
Logout Harbor
|
||||
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
Create An New Project And Go Into Project project_dest${d}
|
||||
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} centos
|
||||
Image Should Be Replicated To Project project_dest${d} centos
|
||||
Push Special Image To Project project${d} ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${image} tags=@{tags} size=${image_size}
|
||||
# Use tag as identifier for this artifact
|
||||
Image Should Be Replicated To Project project_dest${d} ${image} tag=${tag1} expected_image_size_in_regexp=4(\\\.\\d{1,2})*GB
|
||||
Close Browser
|
||||
|
||||
Test Case - Replication Of Pull Images from AWS-ECR To Self
|
||||
|
@ -24,7 +24,48 @@ ${SSH_USER} root
|
||||
${HARBOR_ADMIN} admin
|
||||
|
||||
*** Test Cases ***
|
||||
Test Case - GC Schedule Job
|
||||
[tags] GC_schedule
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%M
|
||||
Log To Console GC Schedule Job ${d}
|
||||
${project_name}= Set Variable gc_schedule_proj${d}
|
||||
${image}= Set Variable redis
|
||||
${tag}= Set Variable latest
|
||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
Create An New Project And Go Into Project ${project_name}
|
||||
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${project_name} ${image}:${tag}
|
||||
Sleep 50
|
||||
Go Into Repo ${project_name}/${image}
|
||||
Switch To Garbage Collection
|
||||
Switch To GC History
|
||||
Set GC Schedule custom value=0 */2 * * * *
|
||||
Sleep 480
|
||||
Set GC Schedule none
|
||||
Sleep 180
|
||||
${logs}= Get GC Logs
|
||||
${logs}= Should Match Regexp ${logs} \\\[(.+)\\\]
|
||||
Log All logs:${logs}[1]
|
||||
${logs} = Replace String ${logs}[1] \\ ${EMPTY} count=-1
|
||||
${logs} = Replace String ${logs} "{ { count=-1
|
||||
${logs} = Replace String ${logs} }" } count=-1
|
||||
Log All str:${logs}
|
||||
${logs_list}= Get Regexp Matches ${logs} {"creation_time.+?\\d{3}Z"}
|
||||
Log All logs_list:${logs_list}
|
||||
${len}= Get Length ${logs_list}
|
||||
Log All len:${len}
|
||||
FOR ${log} IN @{logs_list}
|
||||
Log All log:${log}
|
||||
${log_json}= evaluate json.loads('''${log}''')
|
||||
Log All log_json:${log_json}
|
||||
Should Be Equal As Strings ${log_json["job_kind"]} SCHEDULE
|
||||
Should Be Equal As Strings '${log_json["job_name"]}' 'GARBAGE_COLLECTION'
|
||||
END
|
||||
#Only return latest 10 records for GC job
|
||||
Should Be True ${len} > 3 and ${len} < 6
|
||||
|
||||
Test Case - Scan Schedule Job
|
||||
[tags] Scan_schedule
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%M
|
||||
Log To Console ${d}
|
||||
@ -45,7 +86,7 @@ Test Case - Scan Schedule Job
|
||||
${left} = Evaluate ${minite_int}%10
|
||||
Log To Console ${i}/${left}
|
||||
Sleep 55
|
||||
Run Keyword If ${left} <= 3 and ${left} != 0 Run Keywords Set Scan Schedule custom value=* */10 * * * * AND Set Suite Variable ${flag} ${true}
|
||||
Run Keyword If ${left} <= 3 and ${left} != 0 Run Keywords Set Scan Schedule custom value=0 */10 * * * * AND Set Suite Variable ${flag} ${true}
|
||||
Exit For Loop If '${flag}' == '${true}'
|
||||
END
|
||||
# After scan custom schedule is set, image should stay in unscanned status.
|
||||
@ -63,6 +104,7 @@ Test Case - Scan Schedule Job
|
||||
View Repo Scan Details High Medium
|
||||
|
||||
Test Case - Replication Schedule Job
|
||||
[tags] Replication_schedule
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%M
|
||||
Log To Console ${d}
|
||||
@ -82,7 +124,7 @@ Test Case - Replication Schedule Job
|
||||
${minite_int} = Convert To Integer ${minite}
|
||||
${left} = Evaluate ${minite_int}%10
|
||||
Log To Console ${i}/${left}
|
||||
Run Keyword If ${left} <= 3 and ${left} != 0 Run Keywords Create A Rule With Existing Endpoint rule${d} pull nightly/{mariadb,centos} image e${d} ${project_name} mode=Scheduled cron=* */10 * * * * AND Set Suite Variable ${flag} ${true}
|
||||
Run Keyword If ${left} <= 3 and ${left} != 0 Run Keywords Create A Rule With Existing Endpoint rule${d} pull nightly/{mariadb,centos} image e${d} ${project_name} mode=Scheduled cron=0 */10 * * * * AND Set Suite Variable ${flag} ${true}
|
||||
Sleep 40
|
||||
Exit For Loop If '${flag}' == '${true}'
|
||||
END
|
||||
@ -99,8 +141,8 @@ Test Case - Replication Schedule Job
|
||||
|
||||
# Delete repository
|
||||
Go Into Project ${project_name}
|
||||
Delete Repo ${project_name}/${image_a}
|
||||
Delete Repo ${project_name}/${image_b}
|
||||
Delete Repo ${project_name} ${image_a}
|
||||
Delete Repo ${project_name} ${image_b}
|
||||
|
||||
# After replication schedule is set, project should contain 2 images.
|
||||
Log To Console Sleep for 600 seconds......
|
||||
|
@ -178,6 +178,7 @@
|
||||
"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",
|
||||
@ -300,6 +301,7 @@
|
||||
"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",
|
||||
@ -429,9 +431,10 @@
|
||||
}
|
||||
],
|
||||
"count_limit":-1,
|
||||
"storage_limit":32985348833280,
|
||||
"storage_limit_for_verify":30,
|
||||
"storage_unit_for_verify":"TB",
|
||||
"storage_limit":57671680,
|
||||
"storage_limit_for_verify":55,
|
||||
"storage_unit_for_verify":"MB",
|
||||
"quotas_usage_display":"of 55MB",
|
||||
"labels":[
|
||||
{
|
||||
"name":"proj2label1"
|
||||
|
@ -88,6 +88,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}
|
||||
|
||||
Test Case - Upgrade Verify
|
||||
[Tags] 2.1-latest
|
||||
@ -115,3 +116,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}
|
||||
|
Loading…
Reference in New Issue
Block a user