Remove chartmuseum test case (#18267)

Harbor deprecates chartmuseum as of v2.8.0
Epic: #17958
Discussion: #15057

Signed-off-by: Yang Jiao <jiaoya@vmware.com>
This commit is contained in:
Yang Jiao 2023-02-24 10:56:28 +08:00 committed by GitHub
parent 10c54c0d82
commit 660e1d1362
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 43 additions and 577 deletions

View File

@ -1,10 +0,0 @@
# -*- coding: utf-8 -*-
import project
import label
import registry
import replication
import repository
import swagger_client
class Harbor(project.Project):
pass

View File

@ -3,8 +3,6 @@ import os
import subprocess import subprocess
import time import time
import client
import swagger_client
import v2_swagger_client import v2_swagger_client
try: try:
@ -27,16 +25,8 @@ def get_endpoint():
harbor_server = os.environ.get("HARBOR_HOST", "localhost:8080") harbor_server = os.environ.get("HARBOR_HOST", "localhost:8080")
return os.environ.get("HARBOR_HOST_SCHEMA", "https")+ "://"+harbor_server+"/api/v2.0" return os.environ.get("HARBOR_HOST_SCHEMA", "https")+ "://"+harbor_server+"/api/v2.0"
def _create_client(server, credential, debug, api_type="products"): def _create_client(server, credential, debug, api_type):
cfg = None
if api_type in ('projectv2', 'artifact', 'repository', 'scanner', 'scan', 'scanall', 'preheat', 'quota',
'replication', 'registry', 'robot', 'gc', 'retention', 'immutable', 'system_cve_allowlist',
'configure', 'user', 'member', 'health', 'label', 'webhook', 'purge', 'audit_log', 'scan_data_export',
'statistic', "system_info", "jobservice", "schedule"):
cfg = v2_swagger_client.Configuration() cfg = v2_swagger_client.Configuration()
else:
cfg = swagger_client.Configuration()
cfg.host = server.endpoint cfg.host = server.endpoint
cfg.verify_ssl = server.verify_ssl cfg.verify_ssl = server.verify_ssl
# support basic auth only for now # support basic auth only for now
@ -55,7 +45,6 @@ def _create_client(server, credential, debug, api_type="products"):
cfg.auth_settings = types.MethodType(lambda self: {}, cfg) cfg.auth_settings = types.MethodType(lambda self: {}, cfg)
return { return {
"products": swagger_client.ProductsApi(swagger_client.ApiClient(cfg)),
"projectv2":v2_swagger_client.ProjectApi(v2_swagger_client.ApiClient(cfg)), "projectv2":v2_swagger_client.ProjectApi(v2_swagger_client.ApiClient(cfg)),
"artifact": v2_swagger_client.ArtifactApi(v2_swagger_client.ApiClient(cfg)), "artifact": v2_swagger_client.ArtifactApi(v2_swagger_client.ApiClient(cfg)),
"preheat": v2_swagger_client.PreheatApi(v2_swagger_client.ApiClient(cfg)), "preheat": v2_swagger_client.PreheatApi(v2_swagger_client.ApiClient(cfg)),
@ -161,7 +150,7 @@ def run_command(command, expected_error_message = None):
return output return output
class Base(object): class Base(object):
def __init__(self, server=None, credential=None, debug=True, api_type="products"): def __init__(self, server=None, credential=None, debug=True, api_type=""):
if server is None: if server is None:
server = Server(endpoint=get_endpoint(), verify_ssl=False) server = Server(endpoint=get_endpoint(), verify_ssl=False)
if not isinstance(server.verify_ssl, bool): if not isinstance(server.verify_ssl, bool):

View File

@ -1,6 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from swagger_client.rest import ApiException
from v2_swagger_client.rest import ApiException from v2_swagger_client.rest import ApiException
import base import base

View File

@ -3,59 +3,6 @@
import os import os
import base import base
def get_chart_file(file_name):
command = ["wget", file_name]
ret = base.run_command(command)
print("Command return: ", ret)
command = ["tar", "xvf", file_name.split('/')[-1]]
ret = base.run_command(command)
print("Command return: ", ret)
def helm_login(harbor_server, user, password):
os.putenv("HELM_EXPERIMENTAL_OCI", "1")
command = ["helm3", "registry", "login", harbor_server, "-u", user, "-p", password]
ret = base.run_command(command)
print("Command return: ", ret)
def helm_save(chart_archive, harbor_server, project, repo_name):
command = ["helm3", "chart","save", chart_archive, harbor_server+"/"+project+"/"+repo_name]
base.run_command(command)
def helm_push(harbor_server, project, repo_name, version):
command = ["helm3", "chart", "push", harbor_server+"/"+project+"/"+repo_name+":"+version]
ret = base.run_command(command)
return ret
def helm_chart_push_to_harbor(chart_file, archive, harbor_server, project, repo_name, version, user, password):
get_chart_file(chart_file)
helm_login(harbor_server, user, password)
helm_save(archive, harbor_server, project, repo_name)
return helm_push(harbor_server, project, repo_name, version)
def helm2_add_repo(helm_repo_name, harbor_url, project, username, password, expected_error_message = None):
command = ["helm2", "repo", "add", "--username=" + username, "--password=" + password, helm_repo_name, harbor_url + "/chartrepo/" + project]
ret = base.run_command(command, expected_error_message = expected_error_message)
def helm2_push(helm_repo_name, chart_file, project, username, password):
get_chart_file(chart_file)
command = ["helm2", "cm-push", "--username=" + username, "--password=" + password, chart_file.split('/')[-1], helm_repo_name]
base.run_command(command)
def helm2_repo_update():
command = ["helm2", "repo", "update"]
base.run_command(command)
def helm2_fetch_chart_file(helm_repo_name, harbor_url, project, username, password, chart_file, expected_add_repo_error_message = None):
helm2_add_repo(helm_repo_name, harbor_url, project, username, password, expected_error_message = expected_add_repo_error_message)
if expected_add_repo_error_message is not None:
return
helm2_repo_update()
command_ls = ["ls"]
base.run_command(command_ls)
command = ["helm2", "fetch", "{}/{}".format(helm_repo_name, chart_file)]
base.run_command(command)
base.run_command(command_ls)
def helm3_7_registry_login(ip, user, password): def helm3_7_registry_login(ip, user, password):
command = ["helm3.7", "registry", "login", ip, "-u", user, "-p", password] command = ["helm3.7", "registry", "login", ip, "-u", user, "-p", password]

View File

@ -131,7 +131,6 @@ class Project(base.Base):
return self._get_client(**kwargs).list_project_members(project_id) return self._get_client(**kwargs).list_project_members(project_id)
def get_project_member(self, project_id, member_id, expect_status_code = 200, expect_response_body = None, **kwargs): def get_project_member(self, project_id, member_id, expect_status_code = 200, expect_response_body = None, **kwargs):
from swagger_client.rest import ApiException
kwargs['api_type'] = 'member' kwargs['api_type'] = 'member'
data = [] data = []
try: try:

View File

@ -2,10 +2,10 @@
import time import time
import base import base
import swagger_client import v2_swagger_client
import docker_api import docker_api
from docker_api import DockerAPI from docker_api import DockerAPI
from swagger_client.rest import ApiException from v2_swagger_client.rest import ApiException
from testutils import DOCKER_USER, DOCKER_PWD from testutils import DOCKER_USER, DOCKER_PWD
def pull_harbor_image(registry, username, password, image, tag, expected_login_error_message = None, expected_error_message = None): def pull_harbor_image(registry, username, password, image, tag, expected_login_error_message = None, expected_error_message = None):
@ -124,7 +124,7 @@ class Repository(base.Base, object):
def add_label_to_tag(self, repo_name, tag, label_id, expect_status_code = 200, **kwargs): def add_label_to_tag(self, repo_name, tag, label_id, expect_status_code = 200, **kwargs):
client = self._get_client(**kwargs) client = self._get_client(**kwargs)
label = swagger_client.Label(id=label_id) label = v2_swagger_client.Label(id=label_id)
_, status_code, _ = client.repositories_repo_name_tags_tag_labels_post_with_http_info(repo_name, tag, label) _, status_code, _ = client.repositories_repo_name_tags_tag_labels_post_with_http_info(repo_name, tag, label)
base._assert_status_code(expect_status_code, status_code) base._assert_status_code(expect_status_code, status_code)
@ -160,7 +160,7 @@ class Repository(base.Base, object):
def retag_image(self, repo_name, tag, src_image, override=True, expect_status_code = 200, expect_response_body = None, **kwargs): def retag_image(self, repo_name, tag, src_image, override=True, expect_status_code = 200, expect_response_body = None, **kwargs):
client = self._get_client(**kwargs) client = self._get_client(**kwargs)
request = swagger_client.RetagReq(tag=tag, src_image=src_image, override=override) request = v2_swagger_client.RetagReq(tag=tag, src_image=src_image, override=override)
try: try:
data, status_code, _ = client.repositories_repo_name_tags_post_with_http_info(repo_name, request) data, status_code, _ = client.repositories_repo_name_tags_post_with_http_info(repo_name, request)

View File

@ -3,8 +3,8 @@
import time import time
import re import re
import base import base
import swagger_client import v2_swagger_client
from swagger_client.rest import ApiException from v2_swagger_client.rest import ApiException
class System(base.Base): class System(base.Base):
def get_gc_history(self, expect_status_code = 200, expect_response_body = None, **kwargs): def get_gc_history(self, expect_status_code = 200, expect_response_body = None, **kwargs):
@ -73,8 +73,8 @@ class System(base.Base):
def set_cve_allowlist(self, expires_at=None, expected_status_code=200, *cve_ids, **kwargs): def set_cve_allowlist(self, expires_at=None, expected_status_code=200, *cve_ids, **kwargs):
client = self._get_client(**kwargs) client = self._get_client(**kwargs)
cve_list = [swagger_client.CVEAllowlistItem(cve_id=c) for c in cve_ids] cve_list = [v2_swagger_client.CVEAllowlistItem(cve_id=c) for c in cve_ids]
allowlist = swagger_client.CVEAllowlist(expires_at=expires_at, items=cve_list) allowlist = v2_swagger_client.CVEAllowlist(expires_at=expires_at, items=cve_list)
try: try:
r = client.system_cve_allowlist_put_with_http_info(allowlist=allowlist, _preload_content=False) r = client.system_cve_allowlist_put_with_http_info(allowlist=allowlist, _preload_content=False)
except Exception as e: except Exception as e:

View File

@ -1,40 +0,0 @@
# coding: utf-8
"""
Harbor API
These APIs provide services for manipulating Harbor project.
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
sys.path.append(os.environ["SWAGGER_CLIENT_PATH"])
import unittest
import testutils
from swagger_client.models.ldap_conf import LdapConf
from pprint import pprint
#Testcase
# Define a LDAP group with harbor admin
class TestLdapPing(unittest.TestCase):
"""AccessLog unit test stubs"""
product_api = testutils.GetProductApi("admin", "Harbor12345")
project_id = 0
def setUp(self):
pass
def tearDown(self):
pass
def testLdapPing(self):
"""Test LdapAdminRole"""
result = self.product_api.ldap_ping_post(ldapconf=LdapConf(ldap_url="10.161.127.236", ldap_search_dn="cn=admin,dc=example,dc=com", ldap_search_password="admin", ldap_scope=2))
pprint(result)
if __name__ == '__main__':
unittest.main()

View File

@ -15,7 +15,6 @@ from library.registry import Registry
from library.repository import pull_harbor_image from library.repository import pull_harbor_image
from library.artifact import Artifact from library.artifact import Artifact
from library.preheat import Preheat from library.preheat import Preheat
import library.containerd
import v2_swagger_client import v2_swagger_client
class TestP2P(unittest.TestCase): class TestP2P(unittest.TestCase):

View File

@ -1,69 +0,0 @@
from __future__ import absolute_import
import unittest
from testutils import ADMIN_CLIENT, CHART_API_CLIENT, suppress_urllib3_warning
from testutils import harbor_server
from testutils import TEARDOWN
import library.repository
import library.helm
from library.robot import Robot
from library.project import Project
from library.user import User
class TestProjects(unittest.TestCase):
@suppress_urllib3_warning
def setUp(self):
self.project= Project()
self.user= User()
self.chart= Chart()
self.robot = Robot()
self.url = ADMIN_CLIENT["endpoint"]
self.chart_api_url = CHART_API_CLIENT['endpoint']
self.user_push_chart_password = "Aa123456"
self.chart_file = "https://storage.googleapis.com/harbor-builds/helm-chart-test-files/harbor-0.2.0.tgz"
self.archive = "harbor/"
self.CHART_NAME=self.archive.replace("/", "")
self.verion = "0.2.0"
self.chart_repo_name = "chart_local"
self.repo_name = "harbor_api_test"
@unittest.skipIf(TEARDOWN == False, "Test data won't be erased.")
def tearDown(self):
#1. Delete user(UA).
self.user.delete_user(TestProjects.user_id, **ADMIN_CLIENT)
def testPushChartToChartRepoByHelm2WithRobotAccount(self):
"""
Test case:
Push Chart File To Chart Repository By Helm V2 With Robot Account
Test step and expected result:
1. Create a new user(UA);
2. Create private project(PA) with user(UA);
3. Create a new robot account(RA) with full priviliges in project(PA) with user(UA);
4. Push chart to project(PA) by Helm2 CLI with robot account(RA);
5. Get chart repositry from project(PA) successfully;
Tear down:
1. Delete user(UA).
"""
#1. Create user(UA);
TestProjects.user_id, user_name = self.user.create_user(user_password = self.user_push_chart_password, **ADMIN_CLIENT)
TestProjects.USER_CLIENT=dict(endpoint = self.url, username = user_name, password = self.user_push_chart_password)
#2. Create private project(PA) with user(UA);
TestProjects.project_id, TestProjects.project_name = self.project.create_project(metadata = {"public": "false"}, **TestProjects.USER_CLIENT)
#3. Create a new robot account(RA) with full priviliges in project(PA) with user(UA);
robot_id, robot_account = self.robot.create_project_robot(TestProjects.project_name,
30 ,**TestProjects.USER_CLIENT)
#4. Push chart to project(PA) by Helm3 CLI with robot account(RA);
chart_cli_ret = library.helm.helm_chart_push_to_harbor(self.chart_file, self.archive, harbor_server, TestProjects.project_name, self.repo_name, self.verion, robot_account.name, robot_account.secret)
if __name__ == '__main__':
unittest.main()

View File

@ -1,97 +0,0 @@
from __future__ import absolute_import
import unittest
from testutils import ADMIN_CLIENT, suppress_urllib3_warning
from testutils import harbor_server
from testutils import TEARDOWN
import library.repository
import library.helm
from library.project import Project
from library.user import User
from library.repository import Repository
from library.artifact import Artifact
class TestProjects(unittest.TestCase):
@suppress_urllib3_warning
def setUp(self):
self.project= Project()
self.user= User()
self.artifact = Artifact()
self.repo= Repository()
self.url = ADMIN_CLIENT["endpoint"]
self.user_push_chart_password = "Aa123456"
self.chart_file = "https://storage.googleapis.com/harbor-builds/helm-chart-test-files/harbor-0.2.0.tgz"
self.archive = "harbor/"
self.version = "0.2.0"
self.repo_name = "harbor_api_test"
@unittest.skipIf(TEARDOWN == False, "Test data won't be erased.")
def tearDown(self):
#1. Delete repository chart(CA) by user(UA);
self.repo.delete_repository(TestProjects.project_push_chart_name, self.repo_name, **TestProjects.USER_CLIENT)
#2. Delete project(PA);
self.project.delete_project(TestProjects.project_push_chart_id, **TestProjects.USER_CLIENT)
#3. Delete user(UA).
self.user.delete_user(TestProjects.user_id, **ADMIN_CLIENT)
def testPushChartByHelmChartCLI(self):
"""
Test case:
Push Chart File By Helm Chart CLI
Test step and expected result:
1. Create a new user(UA);
2. Create a new project(PA) by user(UA);
3. Push an chart(CA) to Harbor by helm3 registry/chart CLI successfully;
4. List artifacts successfully;
5. Get chart(CA) by reference successfully;
6. Get addtion successfully;
7. Delete chart by reference successfully.
Tear down:
1. Delete repository chart(CA) by user(UA);
2. Delete project(PA);
3. Delete user(UA).
"""
#1. Create a new user(UA);
TestProjects.user_id, user_name = self.user.create_user(user_password = self.user_push_chart_password, **ADMIN_CLIENT)
TestProjects.USER_CLIENT=dict(endpoint = self.url, username = user_name, password = self.user_push_chart_password)
#2. Create a new project(PA) by user(UA);
TestProjects.project_push_chart_id, TestProjects.project_push_chart_name = self.project.create_project(metadata = {"public": "false"}, **TestProjects.USER_CLIENT)
#3. Push an chart(CA) to Harbor by helm3 registry/chart CLI successfully;
chart_cli_ret = library.helm.helm_chart_push_to_harbor(self.chart_file, self.archive, harbor_server, TestProjects.project_push_chart_name, self.repo_name, self.version, user_name, self.user_push_chart_password)
#4. List artifacts successfully;
artifacts = self.artifact.list_artifacts(TestProjects.project_push_chart_name, self.repo_name, **TestProjects.USER_CLIENT)
self.assertEqual(artifacts[0].type, 'CHART')
self.assertEqual(artifacts[0].tags[0].name, self.version)
#5.1 Get chart(CA) by reference successfully;
artifact = self.artifact.get_reference_info(TestProjects.project_push_chart_name, self.repo_name, self.version, **TestProjects.USER_CLIENT)
self.assertEqual(artifact.type, 'CHART')
self.assertEqual(artifact.tags[0].name, self.version)
#5.2 Chart bundle can be pulled by ctr successfully;
#oci_ref = harbor_server+"/"+TestProjects.project_push_chart_name+"/"+self.repo_name+":"+self.version
#library.containerd.ctr_images_pull(user_name, self.user_push_chart_password, oci_ref)
#library.containerd.ctr_images_list(oci_ref = oci_ref)
#6. Get addtion successfully;
addition_r = self.artifact.get_addition(TestProjects.project_push_chart_name, self.repo_name, self.version, "readme.md", **TestProjects.USER_CLIENT)
self.assertIn("Helm Chart for Harbor", addition_r[0])
addition_d = self.artifact.get_addition(TestProjects.project_push_chart_name, self.repo_name, self.version, "dependencies", **TestProjects.USER_CLIENT)
self.assertIn("https://kubernetes-charts.storage.googleapis.com", addition_d[0])
addition_v = self.artifact.get_addition(TestProjects.project_push_chart_name, self.repo_name, self.version, "values.yaml", **TestProjects.USER_CLIENT)
self.assertIn("adminserver", addition_v[0])
#7. Delete chart by reference successfully.
self.artifact.delete_artifact(TestProjects.project_push_chart_name, self.repo_name, self.version, **TestProjects.USER_CLIENT)
if __name__ == '__main__':
unittest.main()

View File

@ -15,7 +15,6 @@ from library.repository import push_self_build_image_to_project
from library.base import _assert_status_code from library.base import _assert_status_code
from library.scan import Scan from library.scan import Scan
from library.label import Label from library.label import Label
import library.helm
import base import base
import v2_swagger_client import v2_swagger_client
class TestRobotAccount(unittest.TestCase): class TestRobotAccount(unittest.TestCase):

View File

@ -34,7 +34,6 @@ from pprint import pprint
class TestUserGroup(unittest.TestCase): class TestUserGroup(unittest.TestCase):
"""UserGroup unit test stubs""" """UserGroup unit test stubs"""
product_api = testutils.GetProductApi("admin", "Harbor12345")
usergroup_api = testutils.GetUserGroupApi("admin", "Harbor12345") usergroup_api = testutils.GetUserGroupApi("admin", "Harbor12345")
groupId = 0 groupId = 0
def setUp(self): def setUp(self):

View File

@ -16,7 +16,6 @@ print(sys.path)
files_directory = os.getcwd() + "/tests/files/" files_directory = os.getcwd() + "/tests/files/"
import v2_swagger_client import v2_swagger_client
import swagger_client.models
admin_user = "admin" admin_user = "admin"
admin_pwd = "Harbor12345" admin_pwd = "Harbor12345"
@ -37,17 +36,6 @@ ES_ENDPOINT = os.environ.get('ES_ENDPOINT', '')
BASE_IMAGE = dict(name='busybox', tag='latest') BASE_IMAGE = dict(name='busybox', tag='latest')
BASE_IMAGE_ABS_PATH_NAME = '/' + BASE_IMAGE['name'] + '.tar' BASE_IMAGE_ABS_PATH_NAME = '/' + BASE_IMAGE['name'] + '.tar'
def GetProductApi(username, password, harbor_server= os.environ.get("HARBOR_HOST", '')):
cfg = swagger_client.Configuration()
cfg.host = "https://"+harbor_server+"/api/v2.0"
cfg.username = username
cfg.password = password
cfg.verify_ssl = False
cfg.debug = True
api_client = swagger_client.ApiClient(cfg)
api_instance = swagger_client.ProductsApi(api_client)
return api_instance
def GetRepositoryApi(username, password, harbor_server= os.environ.get("HARBOR_HOST", '')): def GetRepositoryApi(username, password, harbor_server= os.environ.get("HARBOR_HOST", '')):

View File

@ -31,3 +31,8 @@ ${tag_name_xpath} xpath=//*[@id='name']
${add_ok_button} xpath=//*[@id='add-ok'] ${add_ok_button} xpath=//*[@id='add-ok']
${delete_tag_button} xpath=//*[@id='delete-tag'] ${delete_tag_button} xpath=//*[@id='delete-tag']
${dialog_delete_button} xpath=//clr-modal//button[contains(.,'DELETE')] ${dialog_delete_button} xpath=//clr-modal//button[contains(.,'DELETE')]
${harbor_helm_name} harbor-helm-1.7.3
${harbor_helm_filename} harbor-helm-1.7.3.tar.gz
${harbor_helm_version} 1.7.3
${harbor_helm_package} harbor-1.7.3.tgz

View File

@ -25,11 +25,6 @@ Create A Random Permission Item List
... Pull Repository ... Pull Repository
... Delete Repository ... Delete Repository
... Delete Artifact ... Delete Artifact
... Read Helm Chart
... Create Helm Chart Version
... Delete Helm Chart Version
... Create Helm Chart label
... Delete Helm Chart label
... Create Tag ... Create Tag
... Delete Tag ... Delete Tag
... List Tag ... List Tag

View File

@ -18,11 +18,6 @@ Library OperatingSystem
Library Process Library Process
*** Keywords *** *** Keywords ***
Prepare Helm Plugin
Wait Unitl Command Success helm init --stable-repo-url https://charts.helm.sh/stable --client-only
Wait Unitl Command Success helm plugin install https://github.com/chartmuseum/helm-push
Wait Unitl Command Success helm3 plugin install https://github.com/chartmuseum/helm-push
Helm3.7 Registry Login Helm3.7 Registry Login
[Arguments] ${ip} ${user} ${password} [Arguments] ${ip} ${user} ${password}
Wait Unitl Command Success helm3.7 registry login ${ip} -u ${user} -p ${password} Wait Unitl Command Success helm3.7 registry login ${ip} -u ${user} -p ${password}

View File

@ -40,8 +40,6 @@ Nightly Test Setup In Photon
Start Docker Daemon Locally Start Docker Daemon Locally
Log To Console Start Containerd Daemon Locally ... Log To Console Start Containerd Daemon Locally ...
Start Containerd Daemon Locally Start Containerd Daemon Locally
Log To Console wget mariadb ...
Prepare Helm Plugin
Nightly Test Setup In Ubuntu Nightly Test Setup In Ubuntu
[Arguments] ${ip} ${HARBOR_PASSWORD} ${ip1}==${EMPTY} [Arguments] ${ip} ${HARBOR_PASSWORD} ${ip1}==${EMPTY}
@ -49,7 +47,6 @@ Nightly Test Setup In Ubuntu
Prepare Test Tools Prepare Test Tools
Log To Console Start Docker Daemon Locally ... Log To Console Start Docker Daemon Locally ...
Run Keyword Start Docker Daemon Locally Run Keyword Start Docker Daemon Locally
Prepare Helm Plugin
Nightly Test Setup In Ubuntu For Upgrade Nightly Test Setup In Ubuntu For Upgrade
[Arguments] ${ip} ${HARBOR_PASSWORD} ${ip1}==${EMPTY} [Arguments] ${ip} ${HARBOR_PASSWORD} ${ip1}==${EMPTY}
@ -57,7 +54,6 @@ Nightly Test Setup In Ubuntu For Upgrade
Prepare Test Tools Prepare Test Tools
Log To Console Start Docker Daemon Locally ... Log To Console Start Docker Daemon Locally ...
Run Keyword Start Docker Daemon Locally Run Keyword Start Docker Daemon Locally
Prepare Helm Plugin
#For upgrade pipeline: get notary targets key from last execution. #For upgrade pipeline: get notary targets key from last execution.
${rc} ${output}= Run And Return Rc And Output [ -f "/key_store/private_keys_backup.tar.gz" ] && tar -zxvf /key_store/private_keys_backup.tar.gz -C / ${rc} ${output}= Run And Return Rc And Output [ -f "/key_store/private_keys_backup.tar.gz" ] && tar -zxvf /key_store/private_keys_backup.tar.gz -C /

View File

@ -79,7 +79,6 @@ Body Of Scan Image With Empty Vul
Go Into Project library Go Into Project library
Go Into Repo ${image_argument} Go Into Repo ${image_argument}
Scan Repo ${tag} Succeed Scan Repo ${tag} Succeed
Move To Summary Chart
Scan Result Should Display In List Row ${tag} is_no_vulerabilty=${true} Scan Result Should Display In List Row ${tag} is_no_vulerabilty=${true}
Close Browser Close Browser
@ -129,34 +128,6 @@ Body Of Scan Image On Push
View Repo Scan Details @{vulnerability_levels} View Repo Scan Details @{vulnerability_levels}
Close Browser Close Browser
Body Of List Helm Charts
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user027 Test1@34
Create An New Project And Go Into Project project${d}
Switch To Project Charts
Upload Chart files
Go Into Chart Version ${prometheus_chart_name}
Retry Wait Until Page Contains ${prometheus_chart_version}
Go Into Chart Detail ${prometheus_chart_version}
# Summary tab
Retry Wait Until Page Contains Element ${summary_markdown}
Retry Wait Until Page Contains Element ${summary_container}
# Dependency tab
Retry Double Keywords When Error Retry Element Click xpath=${detail_dependency} Retry Wait Until Page Contains Element ${dependency_content}
# Values tab
Retry Double Keywords When Error Retry Element Click xpath=${detail_value} Retry Wait Until Page Contains Element ${value_content}
Go Into Project project${d} has_image=${false}
Retry Keyword N Times When Error 4 Download Chart File ${prometheus_chart_name} ${prometheus_chart_filename}
Multi-delete Chart Files ${prometheus_chart_name} ${harbor_chart_name}
Close Browser
Body Of Push Signed Image Body Of Push Signed Image
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
@ -219,24 +190,6 @@ Manage Project Member Without Sign In Harbor
Push image ${ip} ${sign_in_user} ${sign_in_pwd} project${d} hello-world Push image ${ip} ${sign_in_user} ${sign_in_pwd} project${d} hello-world
User Should Be Guest ${test_user2} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode} User Should Be Guest ${test_user2} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Helm CLI Push Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd}
${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project project${d}
Helm Repo Add ${HARBOR_URL} ${sign_in_user} ${sign_in_pwd} project_name=project${d}
Helm Repo Push ${sign_in_user} ${sign_in_pwd} ${harbor_chart_filename}
Switch To Project Charts
Go Into Chart Version ${harbor_chart_name}
Retry Wait Until Page Contains ${harbor_chart_version}
Helm3 CLI Push Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd}
${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project project${d}
Helm Repo Push ${sign_in_user} ${sign_in_pwd} ${harbor_chart_filename} helm_repo_name=${HARBOR_URL}/chartrepo/project${d} helm_cmd=helm3
Switch To Project Charts
Retry Double Keywords When Error Go Into Chart Version ${harbor_chart_name} Retry Wait Until Page Contains ${harbor_chart_version}
Helm3.7 CLI Work Flow Helm3.7 CLI Work Flow
[Arguments] ${sign_in_user} ${sign_in_pwd} [Arguments] ${sign_in_user} ${sign_in_pwd}
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s

View File

@ -88,10 +88,6 @@ Test Case - Push Index By Docker Manifest
[Tags] push_index [Tags] push_index
Harbor API Test ./tests/apitests/python/test_push_index_by_docker_manifest.py Harbor API Test ./tests/apitests/python/test_push_index_by_docker_manifest.py
Test Case - Push Chart By Helm3 Chart CLI
[Tags] push_chart
Harbor API Test ./tests/apitests/python/test_push_chart_by_helm3_chart_cli.py
Test Case - Push Chart By Helm3.7 Chart CLI Test Case - Push Chart By Helm3.7 Chart CLI
[Tags] push_chart_by_Helm3.7 [Tags] push_chart_by_Helm3.7
Harbor API Test ./tests/apitests/python/test_push_chart_by_helm3.7_chart_cli.py Harbor API Test ./tests/apitests/python/test_push_chart_by_helm3.7_chart_cli.py

View File

@ -1,38 +0,0 @@
# 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.
# 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
Default Tags Nightly
*** Variables ***
${HARBOR_URL} https://${ip}
${SSH_USER} root
${HARBOR_ADMIN} admin
*** Test Cases ***
Test Case - Helm3 CLI Push
Init Chrome Driver
${user}= Set Variable user004
${pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
Helm3 CLI Push Without Sign In Harbor ${user} ${pwd}
Test Case - Helm3.7 CLI Push And Pull In Harbor
Init Chrome Driver
${user}= Set Variable user004
${pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
Retry Keyword N Times When Error 4 Helm3.7 CLI Work Flow ${user} ${pwd}

View File

@ -1,108 +0,0 @@
# 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.
# 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
Default Tags Nightly
*** Variables ***
${HARBOR_URL} https://${ip}
${SSH_USER} root
${HARBOR_ADMIN} admin
*** Test Cases ***
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
Retry Wait Until Page Contains None
Close Browser
Test Case - Scan A Tag In The Repo
Body Of Scan A Tag In The Repo hello-world latest is_no_vulerabilty=${true}
Test Case - Scan As An Unprivileged User
Init Chrome Driver
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world
Sign In Harbor ${HARBOR_URL} user024 Test1@34
Go Into Project library
Go Into Repo hello-world
Select Object latest
Scan Is Disabled
Close Browser
# Chose a empty Vul repo
Test Case - Scan Image With Empty Vul
Body Of Scan Image With Empty Vul busybox latest
Test Case - Manual Scan All
Body Of Manual Scan All Low High Medium Negligible
Test Case - View Scan Error
Init Chrome Driver
${d}= get current date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user026 Test1@34
Create An New Project And Go Into Project project${d}
Push Image ${ip} user026 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
[Tags] run-once
Body Of Scan Image On Push Low High Medium Negligible
Test Case - View Scan Results
[Tags] run-once
Body Of View Scan Results Critical High Medium
Test Case - Project Level Image Serverity Policy
[Tags] run-once
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
${d}= get current date result_format=%m%s
#For docker-hub registry
#${sha256}= Set Variable 9755880356c4ced4ff7745bafe620f0b63dd17747caedba72504ef7bac882089
#For internal CPE harbor registry
${sha256}= Set Variable 0e67625224c1da47cb3270e7a861a83e332f708d3d89dde0cbed432c94824d9a
${image}= Set Variable redis
Create An New Project And Go Into Project project${d}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} sha256=${sha256}
Go Into Project project${d}
Go Into Repo ${image}
Scan Repo ${sha256} Succeed
Navigate To Projects
Go Into Project project${d}
Set Vulnerabilty Serverity 3
Cannot Pull Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} tag=${sha256} err_msg=To continue with pull, please contact your project administrator to exempt matched vulnerabilities through configuring the CVE allowlist
Close Browser
#Important Note: All CVE IDs in CVE Allowlist cases must unique!
Test Case - Verfiy System Level CVE Allowlist
Body Of Verfiy System Level CVE Allowlist mariadb b5e273ed46d2b5a1c96bf8f3ae37aa5e90c6c481e7f7ae66744610d7df79cbd1 CVE-2019-13050\nCVE-2018-19591\nCVE-2018-11236\nCVE-2018-11237\nCVE-2019-13627\nCVE-2018-20839\nCVE-2019-2923\nCVE-2019-2922\nCVE-2019-2911\nCVE-2019-2914\nCVE-2019-2924\nCVE-2019-2910\nCVE-2019-2938\nCVE-2019-2993\nCVE-2019-2974\nCVE-2019-2960\nCVE-2019-2948\nCVE-2019-2946 CVE-2019-2969
Test Case - Verfiy Project Level CVE Allowlist
Body Of Verfiy Project Level CVE Allowlist mariadb b5e273ed46d2b5a1c96bf8f3ae37aa5e90c6c481e7f7ae66744610d7df79cbd1 CVE-2019-13050\nCVE-2018-19591\nCVE-2018-11236\nCVE-2018-11237\nCVE-2019-13627\nCVE-2018-20839\nCVE-2019-2923\nCVE-2019-2922\nCVE-2019-2911\nCVE-2019-2914\nCVE-2019-2924\nCVE-2019-2910\nCVE-2019-2938\nCVE-2019-2993\nCVE-2019-2974\nCVE-2019-2960\nCVE-2019-2948\nCVE-2019-2946 CVE-2019-2969
Test Case - Verfiy Project Level CVE Allowlist By Quick Way of Add System
Body Of Verfiy Project Level CVE Allowlist By Quick Way of Add System mariadb b5e273ed46d2b5a1c96bf8f3ae37aa5e90c6c481e7f7ae66744610d7df79cbd1 CVE-2019-13050\nCVE-2018-19591\nCVE-2018-11236\nCVE-2018-11237\nCVE-2019-13627\nCVE-2018-20839\nCVE-2019-2923\nCVE-2019-2922\nCVE-2019-2911\nCVE-2019-2914\nCVE-2019-2924\nCVE-2019-2910\nCVE-2019-2938\nCVE-2019-2993\nCVE-2019-2974\nCVE-2019-2960\nCVE-2019-2948\nCVE-2019-2946\nCVE-2019-2969

View File

@ -1007,3 +1007,11 @@ Test Case - Export CVE
${actual_cve_data}= Split To Lines @{csv_file_content} 1 ${actual_cve_data}= Split To Lines @{csv_file_content} 1
Lists Should Be Equal ${expected_cve_data} ${actual_cve_data} ignore_order=True Lists Should Be Equal ${expected_cve_data} ${actual_cve_data} ignore_order=True
Close Browser Close Browser
Test Case - Helm3.7 CLI Push And Pull In Harbor
[Tags] helm_push_and_push
Init Chrome Driver
${user}= Set Variable user004
${pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
Retry Keyword N Times When Error 4 Helm3.7 CLI Work Flow ${user} ${pwd}

View File

@ -81,13 +81,6 @@ Test Case - Generate User CLI Secret
Push image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image} Push image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image}
Close Browser Close Browser
Test Case - Helm CLI Push
Init Chrome Driver
Sign In Harbor With OIDC User ${HARBOR_URL}
${secret}= Get Secrete By API ${HARBOR_URL}
Helm CLI Push Without Sign In Harbor ${OIDC_USERNAME} ${secret}
Close Browser
Test Case - Onboard OIDC User Sign In Test Case - Onboard OIDC User Sign In
Init Chrome Driver Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} is_oidc=${true} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} is_oidc=${true}

View File

@ -90,13 +90,12 @@ Test Case - Replication Rule Edit
${endpoint2}= Set Variable e2${d} ${endpoint2}= Set Variable e2${d}
${rule_name_old}= Set Variable rule_testabc${d} ${rule_name_old}= Set Variable rule_testabc${d}
${rule_name_new}= Set Variable rule_abctest${d} ${rule_name_new}= Set Variable rule_abctest${d}
${resource_type}= Set Variable chart ${resource_type}= Set Variable image
${dest_namespace}= Set Variable dest_namespace${d} ${dest_namespace}= Set Variable dest_namespace${d}
${mode}= Set Variable Scheduled ${mode}= Set Variable Scheduled
${cron_str}= Set Variable 10 10 10 * * * ${cron_str}= Set Variable 10 10 10 * * *
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries Switch To Registries
#Due to docker-hub access limitation, remove docker-hub endpoint
Create A New Endpoint harbor ${endpoint1} https://cicd.harbor.vmwarecna.net ${null} ${null} Y Create A New Endpoint harbor ${endpoint1} https://cicd.harbor.vmwarecna.net ${null} ${null} Y
Create A New Endpoint harbor ${endpoint2} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y Create A New Endpoint harbor ${endpoint2} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y
Switch To Replication Manage Switch To Replication Manage
@ -127,6 +126,7 @@ Test Case - Replication Rule Edit
Close Browser Close Browser
Test Case - Replication Rule Delete Test Case - Replication Rule Delete
[Tags] test
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
${endpoint1}= Set Variable e1${d} ${endpoint1}= Set Variable e1${d}
@ -230,37 +230,6 @@ Test Case - Replication Exclusion Mode And Set Bandwidth
Retry Wait Until Page Contains 1 - 1 of 1 items Retry Wait Until Page Contains 1 - 1 of 1 items
Close Browser Close Browser
Test Case - Replication Of Push Chart from Self To Harbor
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
#login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d}
Switch To Project Charts
Upload Chart files
Switch To Registries
Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} push project${d}/* chart e${d} project_dest${d}
#logout and login target
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project_dest${d}
#logout and login source
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Select Rule And Replicate rule${d}
Sleep 20
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project project_dest${d} has_image=${false}
Switch To Project Charts
Go Into Chart Version ${harbor_chart_name}
Retry Wait Until Page Contains ${harbor_chart_version}
Go Into Chart Detail ${harbor_chart_version}
Close Browser
Test Case - Replication Of Push Images from Self To Harbor By Push Event Test Case - Replication Of Push Images from Self To Harbor By Push Event
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s

View File

@ -53,7 +53,6 @@ Test Case - Project Tab Routing
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
&{routing}= Create Dictionary harbor/projects/1/summary=//project-detail//summary &{routing}= Create Dictionary harbor/projects/1/summary=//project-detail//summary
... harbor/projects/1/repositories=//project-detail//hbr-repository-gridview ... harbor/projects/1/repositories=//project-detail//hbr-repository-gridview
... harbor/projects/1/helm-charts=//project-detail//project-list-charts
... harbor/projects/1/members=//project-detail//ng-component//button//span[contains(.,'User')] ... harbor/projects/1/members=//project-detail//ng-component//button//span[contains(.,'User')]
... harbor/projects/1/labels=//project-detail//app-project-config//hbr-label ... harbor/projects/1/labels=//project-detail//app-project-config//hbr-label
... harbor/projects/1/scanner=//project-detail//scanner ... harbor/projects/1/scanner=//project-detail//scanner