Skip to content

Commit

Permalink
Remove notary test cases (#18620)
Browse files Browse the repository at this point in the history
Fix #17955

Signed-off-by: Yang Jiao <[email protected]>
  • Loading branch information
YangJiao0817 committed Apr 28, 2023
1 parent 010042f commit c09e539
Show file tree
Hide file tree
Showing 25 changed files with 23 additions and 619 deletions.
15 changes: 0 additions & 15 deletions tests/apitests/python/library/sign.py

This file was deleted.

25 changes: 0 additions & 25 deletions tests/apitests/python/sign_image.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def testProjectLevelPolicyContentTrust(self):
4. Image(IA) should exist;
5. Pull image(IA) successfully;
6. Enable content trust in project(PA) configuration;
7. Pull image(IA) failed and the reason is "The image is not signed in Notary".
7. Pull image(IA) failed and the reason is "The image is not signed in Cosign".
Tear down:
1. Delete repository(RA) by user(UA);
2. Delete project(PA);
Expand Down Expand Up @@ -76,15 +76,15 @@ def testProjectLevelPolicyContentTrust(self):

self.project.get_project(TestProjects.project_content_trust_id)
#6. Enable content trust in project(PA) configuration;
self.project.update_project(TestProjects.project_content_trust_id, metadata = {"enable_content_trust": "true"}, **TestProjects.USER_CONTENT_TRUST_CLIENT)
self.project.update_project(TestProjects.project_content_trust_id, metadata = {"enable_content_trust_cosign": "true"}, **TestProjects.USER_CONTENT_TRUST_CLIENT)
self.project.get_project(TestProjects.project_content_trust_id)

#7. Pull image(IA) failed and the reason is "The image is not signed in Notary".
#7. Pull image(IA) failed and the reason is "The image is not signed in Cosign".
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")
pull_harbor_image(harbor_server, ADMIN_CLIENT["username"], ADMIN_CLIENT["password"], TestProjects.repo_name, tag, expected_error_message = "The image is not signed in Cosign")

if __name__ == '__main__':
unittest.main()
Expand Down
6 changes: 2 additions & 4 deletions tests/apitests/python/test_push_files_by_oras.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from __future__ import absolute_import
import unittest
import urllib

from testutils import ADMIN_CLIENT, suppress_urllib3_warning
from testutils import harbor_server
from testutils import TEARDOWN
import library.oras
from library.sign import sign_image
from library.user import User
from library.project import Project
from library.repository import Repository
Expand All @@ -26,7 +24,7 @@ def setUp(self):
@unittest.skipIf(TEARDOWN == False, "Test data won't be erased.")
def tearDown(self):
#1. Delete user(UA);
self.user.delete_user(TestProjects.user_sign_image_id, **ADMIN_CLIENT)
self.user.delete_user(TestProjects.user_id, **ADMIN_CLIENT)

def testOrasCli(self):
"""
Expand All @@ -47,7 +45,7 @@ def testOrasCli(self):
user_001_password = "Aa123456"

#1. Create user-001
TestProjects.user_sign_image_id, user_name = self.user.create_user(user_password = user_001_password, **ADMIN_CLIENT)
TestProjects.user_id, user_name = self.user.create_user(user_password = user_001_password, **ADMIN_CLIENT)

TestProjects.USER_CLIENT=dict(with_signature = True, endpoint = url, username = user_name, password = user_001_password)

Expand Down
1 change: 0 additions & 1 deletion tests/apitests/python/test_push_image_with_special_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from testutils import ADMIN_CLIENT, suppress_urllib3_warning
from testutils import harbor_server
from testutils import TEARDOWN
from library.sign import sign_image
from library.artifact import Artifact
from library.project import Project
from library.user import User
Expand Down
4 changes: 1 addition & 3 deletions tests/apitests/python/test_scan_image_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from library.repository import push_self_build_image_to_project
from library.artifact import Artifact
from library.scan import Scan
from library.sign import sign_image

class TestScan(unittest.TestCase):
@suppress_urllib3_warning
Expand Down Expand Up @@ -105,8 +104,7 @@ def testScanSignedImage(self):
image = BASE_IMAGE['name']
tag = BASE_IMAGE['tag']
#5. Create a new repository(RA) and tag(TA) in project(PA) by user(UA);
# Push base image in function sign_image.
sign_image(harbor_server, self.project_name, image, tag)
push_self_build_image_to_project(self.project_name, harbor_server, self.user_name, self.user_password, image, tag)

#6. Send scan image command and get tag(TA) information to check scan result, it should be finished;
self.scan.scan_artifact(self.project_name, image, tag, **self.USER_CLIENT)
Expand Down
87 changes: 0 additions & 87 deletions tests/apitests/python/test_sign_image.py

This file was deleted.

1 change: 0 additions & 1 deletion tests/apitests/python/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
CHART_API_CLIENT=dict(endpoint = os.environ.get("HARBOR_HOST_SCHEMA", "https")+ "://"+harbor_server+"/api", username = admin_user, password = admin_pwd)
USER_ROLE=dict(admin=0,normal=1)
TEARDOWN = os.environ.get('TEARDOWN', 'true').lower() in ('true', 'yes')
notary_url = os.environ.get('NOTARY_URL', 'https://'+harbor_server+':4443')
DOCKER_USER = os.environ.get('DOCKER_USER', '')
DOCKER_PWD = os.environ.get('DOCKER_PWD', '')
METRIC_URL = os.environ.get('METRIC_URL', 'http://'+harbor_server+':9090')
Expand Down
19 changes: 0 additions & 19 deletions tests/notarytest.sh

This file was deleted.

7 changes: 0 additions & 7 deletions tests/resources/Harbor-Pages/Project-Config.robot
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ Click Project Public
Mouse Down //hbr-project-policy-config//input[@name='public']
Mouse Up //hbr-project-policy-config//input[@name='public']

Click Notary Deployment Security
Mouse Down //input[@id='content-trust']
Mouse Up //input[@id='content-trust']

Click Cosign Deployment Security
Mouse Down //input[@id='content-trust-cosign']
Mouse Up //input[@id='content-trust-cosign']
Expand Down Expand Up @@ -50,9 +46,6 @@ Project Should Be Public
[Arguments] ${projectName}
Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${projectName}')]//clr-dg-cell[contains(.,'Public')]

Content Notary Deployment security Be Selected
Checkbox Should Be Selected //input[@id='content-trust']

Content Cosign Deployment security Be Selected
Checkbox Should Be Selected //input[@id='content-trust-cosign']

Expand Down
6 changes: 1 addition & 5 deletions tests/resources/Harbor-Pages/Project.robot
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,6 @@ Should Be Signed By Cosign
[Arguments] ${tag}
Retry Wait Element Visible //clr-dg-row[contains(.,'${tag}')]//clr-icon[contains(@class,'signed')]

Should Be Signed By Notary
[Arguments] ${tag}
Retry Wait Element Visible //clr-dg-row[contains(.,'${tag}')]//clr-icon[contains(@class,'color-green')]

Delete Accessory
[Arguments] ${tag}
Retry Button Click //clr-dg-row[contains(.,'${tag}')]//button[contains(@class,'datagrid-expandable-caret-button')]
Expand Down Expand Up @@ -420,4 +416,4 @@ Download Latest CVE CSV File
${csv_file_path}= Set Variable ${download_directory}/${csv_file_name}.csv
Retry Double Keywords When Error Retry Element Click ${latest_download_cve_csv_file_xpath} Retry Wait Until Page Does Not Contains ${csv_file_name}
Retry File Should Exist ${csv_file_path}
[Return] ${csv_file_path}
[Return] ${csv_file_path}
9 changes: 0 additions & 9 deletions tests/resources/Harbor-Pages/Verify.robot
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,3 @@ Verify Quotas Display
Should Match Regexp ${storage_quota_ret} ${str_expected}
END
Close Browser


Verify Re-sign Image
[Arguments] ${json}
Log To Console "Verify Quotas Display..."
@{project}= Get Value From Json ${json} $.notary_projects.[*].name
FOR ${project} IN @{project}
Body Of Admin Push Signed Image ${project} alpine new_tag ${HARBOR_ADMIN} ${HARBOR_PASSWORD} clear_trust_dir=${false}
END
42 changes: 14 additions & 28 deletions tests/resources/Harbor-Util.robot
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,35 @@ Install Harbor to Test Server
Generate Certificate Authority For Chrome

Up Harbor
[Arguments] ${with_notary}=true
${rc} ${output}= Run And Return Rc And Output make start -e NOTARYFLAG=${with_notary}
[Arguments]
${rc} ${output}= Run And Return Rc And Output make start
Log ${rc}
Log ${output}
Should Be Equal As Integers ${rc} 0

Down Harbor
[Arguments] ${with_notary}=true
${rc} ${output}= Run And Return Rc And Output echo "Y" | make down -e NOTARYFLAG=${with_notary}
[Arguments]
${rc} ${output}= Run And Return Rc And Output echo "Y" | make down
Log ${rc}
Log ${output}
Should Be Equal As Integers ${rc} 0

Package Harbor Offline
[Arguments] ${with_notary}=true ${with_trivy}=true
[Arguments] ${with_trivy}=true
Log To Console \nStart Docker Daemon
Start Docker Daemon Locally
Log To Console make package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=%{Harbor_Build_Base_Tag} NPM_REGISTRY=%{NPM_REGISTRY} VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} TRIVYFLAG=${with_trivy} HTTPPROXY=
${rc} ${output}= Run And Return Rc And Output make package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=%{Harbor_Build_Base_Tag} NPM_REGISTRY=%{NPM_REGISTRY} VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} TRIVYFLAG=${with_trivy} HTTPPROXY=
Log To Console make package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=%{Harbor_Build_Base_Tag} NPM_REGISTRY=%{NPM_REGISTRY} VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} TRIVYFLAG=${with_trivy} HTTPPROXY=
${rc} ${output}= Run And Return Rc And Output make package_offline GOBUILDTAGS="include_oss include_gcs" BASEIMAGETAG=%{Harbor_Build_Base_Tag} NPM_REGISTRY=%{NPM_REGISTRY} VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} TRIVYFLAG=${with_trivy} HTTPPROXY=
Log To Console ${rc}
Log To Console ${output}
Should Be Equal As Integers ${rc} 0

Package Harbor Online
[Arguments] ${with_notary}=true ${with_trivy}=true
[Arguments] ${with_trivy}=true
Log To Console \nStart Docker Daemon
Start Docker Daemon Locally
Log To Console \nmake package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} TRIVYFLAG=${with_trivy} HTTPPROXY=
${rc} ${output}= Run And Return Rc And Output make package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} NOTARYFLAG=${with_notary} TRIVYFLAG=${with_trivy} HTTPPROXY=
Log To Console \nmake package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} TRIVYFLAG=${with_trivy} HTTPPROXY=
${rc} ${output}= Run And Return Rc And Output make package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=%{Harbor_Assets_Version} PKGVERSIONTAG=%{Harbor_Package_Version} TRIVYFLAG=${with_trivy} HTTPPROXY=
Log ${rc}
Log ${output}
Should Be Equal As Integers ${rc} 0
Expand Down Expand Up @@ -103,23 +103,9 @@ Get Harbor CA
Log All ${output}
Should Be Equal As Integers ${rc} 0

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

Prepare
[Arguments] ${with_notary}=true
${rc} ${output}= Run And Return Rc And Output make prepare -e NOTARYFLAG=${with_notary}
[Arguments]
${rc} ${output}= Run And Return Rc And Output make prepare
Log ${rc}
Log ${output}
Should Be Equal As Integers ${rc} 0
Expand Down Expand Up @@ -152,8 +138,8 @@ Prepare Cert
Should Be Equal As Integers ${rc} 0

Compile and Up Harbor With Source Code
[Arguments] ${with_notary}=true
${rc} ${output}= Run And Return Rc And Output make install swagger_client NOTARYFLAG=${with_notary} HTTPPROXY=
[Arguments]
${rc} ${output}= Run And Return Rc And Output make install swagger_client HTTPPROXY=
Log ${output}
Should Be Equal As Integers ${rc} 0
Sleep 20
Expand Down
4 changes: 0 additions & 4 deletions tests/resources/Nightly-Util.robot
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ Nightly Test Setup In Ubuntu For Upgrade
Prepare Test Tools
Log To Console Start Docker Daemon Locally ...
Run Keyword Start Docker Daemon Locally
#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 /

CA Setup In ubuntu
[Arguments] ${ip} ${HARBOR_PASSWORD} ${cert}
Expand All @@ -81,8 +79,6 @@ Collect Logs
SSHLibrary.Get File /var/log/harbor/adminserver.log
SSHLibrary.Get File /var/log/harbor/jobservice.log
SSHLibrary.Get File /var/log/harbor/postgresql.log
SSHLibrary.Get File /var/log/harbor/notary-server.log
SSHLibrary.Get File /var/log/harbor/notary-signer.log
SSHLibrary.Get File /var/log/harbor/registryctl.log
Run rename 's/^/${ip}/' *.log
Close All Connections
Loading

0 comments on commit c09e539

Please sign in to comment.