2021-04-24 04:51:13 +02:00
# 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
2018-01-23 06:04:19 +01:00
*** Settings ***
Documentation Harbor BATs
Resource ../../resources/Util.robot
2018-02-28 12:37:25 +01:00
Suite Setup Nightly Test Setup ${ip} ${SSH_PWD} ${HARBOR_PASSWORD} ${ip1}
Suite Teardown Collect Nightly Logs ${ip} ${SSH_PWD} ${ip1}
2018-01-23 06:04:19 +01:00
Default Tags Nightly
*** Variables ***
${HARBOR_URL} https://${ip}
${SSH_USER} root
${HARBOR_ADMIN} admin
*** Test Cases ***
2018-06-01 08:38:10 +02:00
Test Case - Get Harbor Version
#Just get harbor version and log it
Get Harbor Version
2019-11-07 05:53:24 +01:00
Test Case - Clair Is Default Scanner And It Is immutable
2018-03-12 07:20:37 +01:00
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
2019-11-07 05:53:24 +01:00
Switch To Scanners Page
Should Display The Default Clair Scanner
Clair Is Immutable Scanner
2018-03-12 07:20:37 +01:00
2018-03-26 03:22:35 +02:00
Test Case - Read Only Mode
2018-04-16 05:37:20 +02:00
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true
2018-04-16 05:37:20 +02:00
2018-03-26 03:22:35 +02:00
Enable Read Only
Cannot Push image ${ip} tester${d} Test1@34 project${d} busybox:latest
Disable Read Only
Push image ${ip} tester${d} Test1@34 project${d} busybox:latest
Close Browser
2018-04-25 10:24:11 +02:00
Test Case - Repo Size
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library alpine 2.6 2.6
Go Into Project library
Go Into Repo alpine
Page Should Contain 1.92MB
Close Browser
Test Case - Staticsinfo
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
${privaterepocount1}= Get Statics Private Repo
${privateprojcount1}= Get Statics Private Project
${publicrepocount1}= Get Statics Public Repo
${publicprojcount1}= Get Statics Public Project
${totalrepocount1}= Get Statics Total Repo
${totalprojcount1}= Get Statics Total Project
Create An New Project private${d}
Create An New Project public${d} true
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} private${d} hello-world
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} public${d} hello-world
Reload Page
${privaterepocount2}= Get Statics Private Repo
${privateprojcount2}= get statics private project
${publicrepocount2}= get statics public repo
${publicprojcount2}= get statics public project
${totalrepocount2}= get statics total repo
${totalprojcount2}= get statics total project
${privateprojcount}= evaluate ${privateprojcount1}+1
${privaterepocount}= evaluate ${privaterepocount1}+1
${publicprojcount}= evaluate ${publicprojcount1}+1
${publicrepocount}= evaluate ${publicrepocount1}+1
${totalrepocount}= evaluate ${totalrepocount1}+2
${totalprojcount}= evaluate ${totalprojcount1}+2
Should Be Equal As Integers ${privateprojcount2} ${privateprojcount}
Should be equal as integers ${privaterepocount2} ${privaterepocount}
Should be equal as integers ${publicprojcount2} ${publicprojcount}
Should be equal as integers ${publicrepocount2} ${publicrepocount}
Should be equal as integers ${totalprojcount2} ${totalprojcount}
Should be equal as integers ${totalrepocount2} ${totalrepocount}
2018-01-23 06:04:19 +01:00
Test Case - Create An New User
2018-04-02 08:45:52 +02:00
Init Chrome Driver
2018-01-23 06:04:19 +01:00
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
2018-01-23 06:04:19 +01:00
Close Browser
Test Case - Sign With Admin
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Close Browser
Test Case - Update User Comment
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
2018-01-23 06:04:19 +01:00
Update User Comment Test12#4
Logout Harbor
Test Case - Update Password
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
2018-01-23 06:04:19 +01:00
Change Password Test1@34 Test12#4
Logout Harbor
Sign In Harbor ${HARBOR_URL} tester${d} Test12#4
Close Browser
2018-04-02 08:45:52 +02:00
2018-01-23 06:04:19 +01:00
Test Case - Create An New Project
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
2018-01-23 06:04:19 +01:00
Create An New Project test${d}
Close Browser
Test Case - User View Projects
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
2018-01-23 06:04:19 +01:00
Create An New Project test${d}1
Create An New Project test${d}2
Create An New Project test${d}3
Switch To Log
Capture Page Screenshot UserViewProjects.png
Wait Until Page Contains test${d}1
Wait Until Page Contains test${d}2
Wait Until Page Contains test${d}3
2018-04-02 08:45:52 +02:00
Close Browser
2018-01-23 06:04:19 +01:00
Test Case - Push Image
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
2018-01-23 06:04:19 +01:00
Create An New Project test${d}
Push image ${ip} tester${d} Test1@34 test${d} hello-world:latest
Go Into Project test${d}
Wait Until Page Contains test${d}/hello-world
Test Case - User View Logs
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2018-04-02 08:45:52 +02:00
2021-04-24 04:51:13 +02:00
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true
2018-01-23 06:04:19 +01:00
Push image ${ip} tester${d} Test1@34 project${d} busybox:latest
Pull image ${ip} tester${d} Test1@34 project${d} busybox:latest
2018-04-02 08:45:52 +02:00
2018-01-23 06:04:19 +01:00
Go Into Project project${d}
Delete Repo project${d}
2018-04-02 08:45:52 +02:00
2018-01-23 06:04:19 +01:00
Go To Project Log
Advanced Search Should Display
2018-04-02 08:45:52 +02:00
2018-01-23 06:04:19 +01:00
Do Log Advanced Search
Close Browser
2018-04-02 08:45:52 +02:00
2018-01-23 06:04:19 +01:00
Test Case - Manage project publicity
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=usera${d} email=usera${d}@harbortest.com realname=usera${d} newPassword=Test1@34 comment=harbor
2018-01-23 06:04:19 +01:00
Logout Harbor
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=userb${d} email=userb${d}@harbortest.com realname=userb${d} newPassword=Test1@34 comment=harbor
2018-01-23 06:04:19 +01:00
Logout Harbor
Sign In Harbor ${HARBOR_URL} usera${d} Test1@34
Create An New Project project${d} public=true
Push image ${ip} usera${d} Test1@34 project${d} hello-world:latest
Pull image ${ip} userb${d} Test1@34 project${d} hello-world:latest
Logout Harbor
Sign In Harbor ${HARBOR_URL} userb${d} Test1@34
Project Should Display project${d}
Search Private Projects
Project Should Not Display project${d}
Logout Harbor
Sign In Harbor ${HARBOR_URL} usera${d} Test1@34
Make Project Private project${d}
Logout Harbor
Sign In Harbor ${HARBOR_URL} userb${d} Test1@34
Project Should Not Display project${d}
Cannot Pull image ${ip} userb${d} Test1@34 project${d} hello-world:latest
Logout Harbor
Sign In Harbor ${HARBOR_URL} usera${d} Test1@34
Make Project Public project${d}
Logout Harbor
Sign In Harbor ${HARBOR_URL} userb${d} Test1@34
Project Should Display project${d}
Close Browser
Test Case - Project Level Policy Public
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project${d}
2018-12-25 08:44:44 +01:00
Go Into Project project${d} has_image=${false}
2018-01-23 06:04:19 +01:00
Goto Project Config
Click Project Public
Save Project Config
2018-01-25 13:35:44 +01:00
# Verify
2018-04-02 08:45:52 +02:00
Public Should Be Selected
2018-01-25 13:35:44 +01:00
# Project${d} default should be private
2018-02-28 12:36:58 +01:00
# Here logout and login to try avoid a bug only in autotest
Logout Harbor
2018-04-02 08:45:52 +02:00
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
2018-02-28 12:36:58 +01:00
Filter Object project${d}
2018-01-23 06:04:19 +01:00
Project Should Be Public project${d}
Close Browser
Test Case - Project Level Policy Content Trust
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project${d}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world:latest
Go Into Project project${d}
Goto Project Config
Click Content Trust
Save Project Config
2018-01-25 13:35:44 +01:00
# Verify
2018-01-23 06:04:19 +01:00
Content Trust Should Be Selected
Cannot Pull Unsigned Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world:latest
Close Browser
Test Case - Edit Project Creation
2018-01-25 13:35:44 +01:00
# Create normal user and login
2018-01-23 06:04:19 +01:00
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
2018-01-23 06:04:19 +01:00
Project Creation Should Display
Logout Harbor
Sleep 3
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Set Pro Create Admin Only
Logout Harbor
Sign In Harbor ${HARBOR_URL} tester${d} Test1@34
Project Creation Should Not Display
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Set Pro Create Every One
Close browser
Test Case - Edit Self-Registration
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Disable Self Reg
Logout Harbor
Sign Up Should Not Display
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Configure
Self Reg Should Be Disabled
Sleep 1
2018-01-25 13:35:44 +01:00
# Restore setting
2018-01-23 06:04:19 +01:00
Enable Self Reg
Close Browser
Test Case - Edit Email Settings
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Email
Config Email
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Email
Verify Email
Close Browser
Test Case - Edit Token Expire
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To System Settings
Modify Token Expiration 20
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To System Settings
Token Must Be Match 20
#reset to default
Modify Token Expiration 30
Close Browser
2018-04-02 08:45:52 +02:00
Test Case - Create A New Labels
Init Chrome Driver
${d}= Get Current Date
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To System Labels
Create New Labels label_${d}
Close Browser
Test Case - Update Label
Init Chrome Driver
${d}= Get Current Date
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To System Labels
Create New Labels label_${d}
Sleep 3
${d1}= Get Current Date
Update A Label label_${d}
Close Browser
Test Case - Delete Label
Init Chrome Driver
${d}= Get Current Date
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To System Labels
Create New Labels label_${d}
Sleep 3
2018-05-24 07:07:19 +02:00
Delete A Label label_${d}
2018-04-02 08:45:52 +02:00
Close Browser
2018-04-09 10:10:07 +02:00
TestCase - Project Admin Operate Labels
2018-04-02 08:45:52 +02:00
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@harbortest.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
2018-04-09 10:10:07 +02:00
2018-12-25 08:44:44 +01:00
Go Into Project project${d} has_image=${false}
2018-04-02 08:45:52 +02:00
Sleep 2
2018-04-09 10:10:07 +02:00
# Add labels
Switch To Project Label
2018-04-02 08:45:52 +02:00
Create New Labels label_${d}
Sleep 2
2018-04-09 10:10:07 +02:00
Update A Label label_${d}
Sleep 2
2018-05-24 07:07:19 +02:00
Delete A Label label_${d}
2018-04-09 10:10:07 +02:00
Close Browser
TestCase - Project Admin Add Labels To Repo
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@harbortest.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
2018-04-16 03:54:27 +02:00
## Push Image With Tag ${ip} test${d} Test1@34 project${d} vmware/photon 1.0 1.0
Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 3.2.10-alpine 3.2.10-alpine
Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 4.0.7-alpine 4.0.7-alpine
2018-04-09 10:10:07 +02:00
2018-04-02 08:45:52 +02:00
Go Into Project project${d}
2018-04-09 10:10:07 +02:00
Sleep 2
# Add labels
Switch To Project Label
2018-04-16 05:37:20 +02:00
Create New Labels label111
2018-04-16 03:54:27 +02:00
Capture Page Screenshot CreateLabel1.png
2018-04-16 05:37:20 +02:00
Create New Labels label22
2018-04-16 03:54:27 +02:00
Capture Page Screenshot CreateLabel2.png
2018-04-09 10:10:07 +02:00
Sleep 2
Switch To Project Repo
2018-04-16 03:54:27 +02:00
Go Into Repo project${d}/redis
2018-04-16 05:37:20 +02:00
Add Labels To Tag 3.2.10-alpine label111
Add Labels To Tag 4.0.7-alpine label22
Filter Labels In Tags label111 label22
2018-04-02 08:45:52 +02:00
Close Browser
2018-04-09 10:10:07 +02:00
TestCase - Developer Operate Labels
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@harbortest.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
2018-04-09 10:10:07 +02:00
Logout Harbor
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=bob${d} email=bob${d}@harbortest.com realname=bob${d} newPassword=Test1@34 comment=habor
2018-04-09 10:10:07 +02:00
Logout Harbor
2018-12-25 08:44:44 +01:00
Manage Project Member test${d} Test1@34 project${d} bob${d} Add has_image=${false}
2018-04-09 10:10:07 +02:00
Change User Role In Project test${d} Test1@34 project${d} bob${d} Developer
Sign In Harbor ${HARBOR_URL} bob${d} Test1@34
2018-12-25 08:44:44 +01:00
Go Into Project project${d} has_image=${false}
2018-04-09 10:10:07 +02:00
Sleep 3
2019-12-27 07:11:01 +01:00
Retry Wait Until Page Not Contains Element xpath=//a[contains(.,'Labels')]
2018-04-09 10:10:07 +02:00
Close Browser
2018-01-23 06:04:19 +01:00
Test Case - Scan A Tag In The Repo
Init Chrome Driver
${d}= get current date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
2018-01-23 06:04:19 +01:00
Push Image ${ip} tester${d} Test1@34 project${d} hello-world
Go Into Project project${d}
Go Into Repo project${d}/hello-world
2018-03-12 07:20:37 +01:00
Scan Repo latest Succeed
2018-01-23 06:04:19 +01:00
Summary Chart Should Display latest
2018-03-12 07:20:37 +01:00
Pull Image ${ip} tester${d} Test1@34 project${d} hello-world
2018-01-25 13:35:44 +01:00
# Edit Repo Info
2018-01-23 06:04:19 +01:00
Close Browser
2018-03-12 07:20:37 +01:00
Test Case - Scan As An Unprivileged User
Init Chrome Driver
${d}= get current date result_format=%m%s
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world
2021-04-24 04:51:13 +02:00
Create An New User ${HARBOR_URL} user${d} user${d}@harbortest.com user${d} Test1@34 harbor
2018-03-12 07:20:37 +01:00
Go Into Project library
Go Into Repo hello-world
Select Object latest
Scan Is Disabled
Close Browser
##
Test Case - Scan Image With Empty Vul
Init Chrome Driver
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project library
Go Into Repo hello-world
Scan Repo latest Succeed
Move To Summary Chart
2019-11-07 05:53:24 +01:00
Wait Until Page Contains No vulnerability
2018-03-12 07:20:37 +01:00
Close Browser
###
Test Case - Disable Scan Schedule
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
2019-03-28 13:36:44 +01:00
Switch To Vulnerability Page
2018-03-12 07:20:37 +01:00
Disable Scan Schedule
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
2019-03-28 13:36:44 +01:00
Switch To Vulnerability Page
2018-03-12 07:20:37 +01:00
Page Should Contain None
Close Browser
###
Test Case - Manual Scan All
Init Chrome Driver
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library redis
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
2019-03-28 13:36:44 +01:00
Switch To Vulnerability Page
2019-11-12 11:47:15 +01:00
Trigger Scan Now And Wait Until The Result Appears
2019-01-28 09:32:45 +01:00
Navigate To Projects
2018-03-12 07:20:37 +01:00
Go Into Project library
Go Into Repo redis
Summary Chart Should Display latest
Close Browser
#
2018-04-02 08:45:52 +02:00
Test Case - Project Level Image Serverity Policy
2018-03-12 07:20:37 +01:00
Init Chrome Driver
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library haproxy
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project library
Go Into Repo haproxy
Scan Repo latest Succeed
2019-01-28 09:32:45 +01:00
Navigate To Projects
2018-03-12 07:20:37 +01:00
Go Into Project library
Set Vulnerabilty Serverity 0
Cannot pull image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library haproxy
Close Browser
2018-04-25 10:24:11 +02:00
Test Case - Verify Download Ca Link
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To System Settings
Page Should Contain Registry Root Certificate
Close Browser
Test Case - Edit Repo Info
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
2018-04-25 10:24:11 +02:00
Push Image ${ip} tester${d} Test1@34 project${d} hello-world
Go Into Project project${d}
Go Into Repo project${d}/hello-world
Edit Repo Info
Close Browser
2018-01-23 06:04:19 +01:00
Test Case - Manage Project Member
Init Chrome Driver
${d}= Get current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New Project With New User url=${HARBOR_URL} username=alice${d} email=alice${d}@harbortest.com realname=alice${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
2018-01-23 06:04:19 +01:00
Push image ip=${ip} user=alice${d} pwd=Test1@34 project=project${d} image=hello-world
Logout Harbor
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=bob${d} email=bob${d}@harbortest.com realname=bob${d} newPassword=Test1@34 comment=habor
2018-01-23 06:04:19 +01:00
Logout Harbor
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=carol${d} email=carol${d}@harbortest.com realname=carol${d} newPassword=Test1@34 comment=harbor
2018-01-23 06:04:19 +01:00
Logout Harbor
User Should Not Be A Member Of Project bob${d} Test1@34 project${d}
Manage Project Member alice${d} Test1@34 project${d} bob${d} Add
User Should Be Guest bob${d} Test1@34 project${d}
Change User Role In Project alice${d} Test1@34 project${d} bob${d} Developer
User Should Be Developer bob${d} Test1@34 project${d}
Change User Role In Project alice${d} Test1@34 project${d} bob${d} Admin
User Should Be Admin bob${d} Test1@34 project${d} carol${d}
Manage Project Member alice${d} Test1@34 project${d} bob${d} Remove
User Should Not Be A Member Of Project bob${d} Test1@34 project${d}
User Should Be Guest carol${d} Test1@34 project${d}
Close Browser
Test Case - Delete A Project
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New Project With New User ${HARBOR_URL} tester${d} tester${d}@harbortest.com tester${d} Test1@34 harobr project${d} false
2018-04-02 08:45:52 +02:00
Push Image ${ip} tester${d} Test1@34 project${d} hello-world
2018-01-23 06:04:19 +01:00
Project Should Not Be Deleted project${d}
Go Into Project project${d}
Delete Repo project${d}
2019-01-28 09:32:45 +01:00
Navigate To Projects
2018-01-23 06:04:19 +01:00
Project Should Be Deleted project${d}
Close Browser
Test Case - Delete Multi Project
Init Chrome Driver
2018-04-02 08:45:52 +02:00
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User ${HARBOR_URL} test${d} test${d}@harbortest.com test${d} Test1@34 harbor
2018-01-23 06:04:19 +01:00
Create An New Project projecta${d}
Create An New Project projectb${d}
Push Image ${ip} test${d} Test1@34 projecta${d} hello-world
Filter Object project
2019-03-11 03:34:53 +01:00
@{project_list} Create List projecta projectb
Multi-delete Object ${project_delete_btn} @{project_list}
2018-01-25 13:35:44 +01:00
# Verify delete project with image should not be deleted directly
2018-05-24 07:07:19 +02:00
Delete Fail projecta${d}
Delete Success projectb${d}
2018-01-23 06:04:19 +01:00
Close Browser
Test Case - Delete Multi User
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User ${HARBOR_URL} deletea${d} testa${d}@harbortest.com test${d} Test1@34 harbor
2018-01-23 06:04:19 +01:00
Logout Harbor
2021-04-24 04:51:13 +02:00
Create An New User ${HARBOR_URL} deleteb${d} testb${d}@harbortest.com test${d} Test1@34 harbor
2018-01-23 06:04:19 +01:00
Logout Harbor
2021-04-24 04:51:13 +02:00
Create An New User ${HARBOR_URL} deletec${d} testc${d}@harbortest.com test${d} Test1@34 harbor
2018-01-23 06:04:19 +01:00
Logout Harbor
Sign In Harbor ${HARBOR_URL} admin Harbor12345
Switch To User Tag
Filter Object delete
2019-03-11 03:34:53 +01:00
@{user_list} Create List deletea deleteb deletec
Multi-delete Object ${user_delete_btn} @{user_list}
2018-04-02 08:45:52 +02:00
# Assert delete
2018-05-24 07:07:19 +02:00
Delete Success deletea deleteb deletec
2018-01-23 06:04:19 +01:00
Sleep 1
Close Browser
Test Case - Delete Multi Repo
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User ${HARBOR_URL} test${d} test${d}@harbortest.com test${d} Test1@34 harbor
2018-01-23 06:04:19 +01:00
Create An New Project project${d}
2018-04-02 08:45:52 +02:00
Push Image ${ip} test${d} Test1@34 project${d} hello-world
2018-01-23 06:04:19 +01:00
Push Image ${ip} test${d} Test1@34 project${d} busybox
Sleep 2
Go Into Project project${d}
2019-03-11 03:34:53 +01:00
@{repo_list} Create List hello-world busybox
Multi-delete Object ${repo_delete_btn} @{repo_list}
2018-01-25 13:35:44 +01:00
# Verify
2018-05-24 07:07:19 +02:00
Delete Success hello-world busybox
2018-01-23 06:04:19 +01:00
Close Browser
Test Case - Delete Multi Tag
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User ${HARBOR_URL} test${d} test${d}@harbortest.com test${d} Test1@34 harbor
2018-01-23 06:04:19 +01:00
Create An New Project project${d}
2018-03-21 11:37:52 +01:00
Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 3.2.10-alpine 3.2.10-alpine
Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 4.0.7-alpine 4.0.7-alpine
2018-01-23 06:04:19 +01:00
Sleep 2
Go Into Project project${d}
2018-02-02 10:43:11 +01:00
Go Into Repo redis
2019-03-11 03:34:53 +01:00
@{tag_list} Create List 3.2.10-alpine 4.0.7-alpine
Multi-delete object ${tag_delete_btn} @{tag_list}
2018-01-25 13:35:44 +01:00
# Verify
2018-05-24 07:07:19 +02:00
Delete Success 3.2.10-alpine 4.0.7-alpine
2018-01-23 06:04:19 +01:00
Close Browser
2018-04-12 13:55:46 +02:00
Test Case - Delete Repo on CardView
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User ${HARBOR_URL} test${d} test${d}@harbortest.com test${d} Test1@34 harbor
2018-04-12 13:55:46 +02:00
Create An New Project project${d}
Push Image ${ip} test${d} Test1@34 project${d} hello-world
Push Image ${ip} test${d} Test1@34 project${d} busybox
Sleep 2
Go Into Project project${d}
Switch To CardView
2018-04-19 04:07:55 +02:00
Delete Repo on CardView busybox
2018-04-12 13:55:46 +02:00
# Verify
2018-05-24 07:07:19 +02:00
Delete Success busybox
2018-04-12 13:55:46 +02:00
Close Browser
2018-01-23 06:04:19 +01:00
Test Case - Delete Multi Member
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User ${HARBOR_URL} testa${d} testa${d}@harbortest.com test${d} Test1@34 harbor
2018-01-23 06:04:19 +01:00
Logout Harbor
2021-04-24 04:51:13 +02:00
Create An New User ${HARBOR_URL} testb${d} testb${d}@harbortest.com test${d} Test1@34 harbor
2018-01-23 06:04:19 +01:00
Logout Harbor
2021-04-24 04:51:13 +02:00
Create An New User ${HARBOR_URL} test${d} test${d}@harbortest.com test${d} Test1@34 harbor
2018-01-23 06:04:19 +01:00
Create An New Project project${d}
2018-12-25 08:44:44 +01:00
Go Into Project project${d} has_image=${false}
2018-01-23 06:04:19 +01:00
Switch To Member
Add Guest Member to project testa${d}
Add Guest Member to project testb${d}
2018-01-30 12:04:24 +01:00
Multi-delete Member testa${d} testb${d}
2018-05-24 07:07:19 +02:00
Delete Success testa${d} testb${d}
2018-01-23 06:04:19 +01:00
Close Browser
2018-04-02 08:45:52 +02:00
2018-01-23 06:04:19 +01:00
Test Case - Assign Sys Admin
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
2018-01-23 06:04:19 +01:00
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch to User Tag
Assign User Admin tester${d}
Logout Harbor
Sign In Harbor ${HARBOR_URL} tester${d} Test1@34
Administration Tag Should Display
Close Browser
Test Case - Admin Push Signed Image
Enable Notary Client
${rc} ${output}= Run And Return Rc And Output docker pull hello-world:latest
Log ${output}
2018-04-02 08:45:52 +02:00
2018-01-23 06:04:19 +01:00
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world:latest
2018-08-24 07:30:07 +02:00
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip}
2018-01-23 06:04:19 +01:00
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/repositories/library/tomcat/signatures"
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} sha256
Test Case - View Scan Results
Init Chrome Driver
${d}= get current date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
2018-01-23 06:04:19 +01:00
Push Image ${ip} tester${d} Test1@34 project${d} tomcat
Go Into Project project${d}
Go Into Repo project${d}/tomcat
2018-03-12 07:20:37 +01:00
Scan Repo latest Succeed
2018-01-23 06:04:19 +01:00
Summary Chart Should Display latest
View Repo Scan Details
Close Browser
Test Case - View Scan Error
Init Chrome Driver
${d}= get current date result_format=%m%s
2021-04-24 04:51:13 +02:00
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
2018-01-23 06:04:19 +01:00
Push Image ${ip} tester${d} Test1@34 project${d} vmware/photon:1.0
Go Into Project project${d}
Go Into Repo project${d}/vmware/photon
2018-03-12 07:20:37 +01:00
Scan Repo 1.0 Fail
2018-01-23 06:04:19 +01:00
View Scan Error Log
Close Browser
2018-06-05 12:51:11 +02:00
Test Case - Scan Image On Push
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project library
Goto Project Config
Enable Scan On Push
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library memcached
2019-01-28 09:32:45 +01:00
Navigate To Projects
2018-06-05 12:51:11 +02:00
Go Into Project library
Go Into Repo memcached
Summary Chart Should Display latest
Close Browser