mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-18 13:41:21 +01:00
add test cases for jenkins upgrade project, wrap test cases body into new keywords, so that case body appears only in one single place (#7243)
Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
parent
d81dabc208
commit
3db3f3a62e
112
tests/resources/TestCaseBody.robot
Normal file
112
tests/resources/TestCaseBody.robot
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
# 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 This resource wrap test case body
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Body Of Manage project publicity
|
||||||
|
Init Chrome Driver
|
||||||
|
${d}= Get Current Date result_format=%m%s
|
||||||
|
|
||||||
|
Sign In Harbor ${HARBOR_URL} user007 Test1@34
|
||||||
|
Create An New Project project${d} public=true
|
||||||
|
|
||||||
|
Push image ${ip} user007 Test1@34 project${d} hello-world:latest
|
||||||
|
Pull image ${ip} user008 Test1@34 project${d} hello-world:latest
|
||||||
|
|
||||||
|
Logout Harbor
|
||||||
|
Sign In Harbor ${HARBOR_URL} user008 Test1@34
|
||||||
|
Project Should Display project${d}
|
||||||
|
Search Private Projects
|
||||||
|
Project Should Not Display project${d}
|
||||||
|
|
||||||
|
Logout Harbor
|
||||||
|
Sign In Harbor ${HARBOR_URL} user007 Test1@34
|
||||||
|
Make Project Private project${d}
|
||||||
|
|
||||||
|
Logout Harbor
|
||||||
|
Sign In Harbor ${HARBOR_URL} user008 Test1@34
|
||||||
|
Project Should Not Display project${d}
|
||||||
|
Cannot Pull image ${ip} user008 Test1@34 project${d} hello-world:latest
|
||||||
|
|
||||||
|
Logout Harbor
|
||||||
|
Sign In Harbor ${HARBOR_URL} user007 Test1@34
|
||||||
|
Make Project Public project${d}
|
||||||
|
|
||||||
|
Logout Harbor
|
||||||
|
Sign In Harbor ${HARBOR_URL} user008 Test1@34
|
||||||
|
Project Should Display project${d}
|
||||||
|
Close Browser
|
||||||
|
|
||||||
|
Body Of Scan A Tag In The Repo
|
||||||
|
Init Chrome Driver
|
||||||
|
${d}= get current date result_format=%m%s
|
||||||
|
|
||||||
|
Sign In Harbor ${HARBOR_URL} user023 Test1@34
|
||||||
|
Create An New Project project${d}
|
||||||
|
Go Into Project project${d} has_image=${false}
|
||||||
|
Push Image ${ip} user023 Test1@34 project${d} hello-world
|
||||||
|
Go Into Project project${d}
|
||||||
|
Go Into Repo project${d}/hello-world
|
||||||
|
Scan Repo latest Succeed
|
||||||
|
Summary Chart Should Display latest
|
||||||
|
Pull Image ${ip} user023 Test1@34 project${d} hello-world
|
||||||
|
# Edit Repo Info
|
||||||
|
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 project${d}
|
||||||
|
Go Into Project project${d} has_image=${false}
|
||||||
|
|
||||||
|
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 Back To Versions And Delete
|
||||||
|
Close Browser
|
||||||
|
|
||||||
|
Body Of Admin Push Signed Image
|
||||||
|
Enable Notary Client
|
||||||
|
|
||||||
|
${rc} ${output}= Run And Return Rc And Output docker pull hello-world:latest
|
||||||
|
Log ${output}
|
||||||
|
|
||||||
|
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world:latest
|
||||||
|
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${notaryServerEndpoint}
|
||||||
|
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
|
@ -60,6 +60,7 @@ Resource Cert-Util.robot
|
|||||||
Resource SeleniumUtil.robot
|
Resource SeleniumUtil.robot
|
||||||
Resource Nightly-Util.robot
|
Resource Nightly-Util.robot
|
||||||
Resource APITest-Util.robot
|
Resource APITest-Util.robot
|
||||||
|
Resource TestCaseBody.robot
|
||||||
|
|
||||||
*** Keywords ***
|
*** Keywords ***
|
||||||
Wait Until Element Is Visible And Enabled
|
Wait Until Element Is Visible And Enabled
|
||||||
|
@ -336,38 +336,7 @@ Test Case - Manage Project Member
|
|||||||
Close Browser
|
Close Browser
|
||||||
|
|
||||||
Test Case - Manage project publicity
|
Test Case - Manage project publicity
|
||||||
Init Chrome Driver
|
Body Of Manage project publicity
|
||||||
${d}= Get Current Date result_format=%m%s
|
|
||||||
|
|
||||||
Sign In Harbor ${HARBOR_URL} user007 Test1@34
|
|
||||||
Create An New Project project${d} public=true
|
|
||||||
|
|
||||||
Push image ${ip} user007 Test1@34 project${d} hello-world:latest
|
|
||||||
Pull image ${ip} user008 Test1@34 project${d} hello-world:latest
|
|
||||||
|
|
||||||
Logout Harbor
|
|
||||||
Sign In Harbor ${HARBOR_URL} user008 Test1@34
|
|
||||||
Project Should Display project${d}
|
|
||||||
Search Private Projects
|
|
||||||
Project Should Not Display project${d}
|
|
||||||
|
|
||||||
Logout Harbor
|
|
||||||
Sign In Harbor ${HARBOR_URL} user007 Test1@34
|
|
||||||
Make Project Private project${d}
|
|
||||||
|
|
||||||
Logout Harbor
|
|
||||||
Sign In Harbor ${HARBOR_URL} user008 Test1@34
|
|
||||||
Project Should Not Display project${d}
|
|
||||||
Cannot Pull image ${ip} user008 Test1@34 project${d} hello-world:latest
|
|
||||||
|
|
||||||
Logout Harbor
|
|
||||||
Sign In Harbor ${HARBOR_URL} user007 Test1@34
|
|
||||||
Make Project Public project${d}
|
|
||||||
|
|
||||||
Logout Harbor
|
|
||||||
Sign In Harbor ${HARBOR_URL} user008 Test1@34
|
|
||||||
Project Should Display project${d}
|
|
||||||
Close Browser
|
|
||||||
|
|
||||||
Test Case - Assign Sys Admin
|
Test Case - Assign Sys Admin
|
||||||
Init Chrome Driver
|
Init Chrome Driver
|
||||||
@ -547,20 +516,7 @@ Test Case - Developer Operate Labels
|
|||||||
Close Browser
|
Close Browser
|
||||||
|
|
||||||
Test Case - Scan A Tag In The Repo
|
Test Case - Scan A Tag In The Repo
|
||||||
Init Chrome Driver
|
Body Of Scan A Tag In The Repo
|
||||||
${d}= get current date result_format=%m%s
|
|
||||||
|
|
||||||
Sign In Harbor ${HARBOR_URL} user023 Test1@34
|
|
||||||
Create An New Project project${d}
|
|
||||||
Go Into Project project${d} has_image=${false}
|
|
||||||
Push Image ${ip} user023 Test1@34 project${d} hello-world
|
|
||||||
Go Into Project project${d}
|
|
||||||
Go Into Repo project${d}/hello-world
|
|
||||||
Scan Repo latest Succeed
|
|
||||||
Summary Chart Should Display latest
|
|
||||||
Pull Image ${ip} user023 Test1@34 project${d} hello-world
|
|
||||||
# Edit Repo Info
|
|
||||||
Close Browser
|
|
||||||
|
|
||||||
Test Case - Scan As An Unprivileged User
|
Test Case - Scan As An Unprivileged User
|
||||||
Init Chrome Driver
|
Init Chrome Driver
|
||||||
@ -612,47 +568,10 @@ Test Case - View Scan Error
|
|||||||
Close Browser
|
Close Browser
|
||||||
|
|
||||||
Test Case - List Helm Charts
|
Test Case - List Helm Charts
|
||||||
Init Chrome Driver
|
Body Of List Helm Charts
|
||||||
${d}= Get Current Date result_format=%m%s
|
|
||||||
|
|
||||||
Sign In Harbor ${HARBOR_URL} user027 Test1@34
|
|
||||||
Create An New Project project${d}
|
|
||||||
Go Into Project project${d} has_image=${false}
|
|
||||||
|
|
||||||
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 Back To Versions And Delete
|
|
||||||
Close Browser
|
|
||||||
|
|
||||||
Test Case - Admin Push Signed Image
|
Test Case - Admin Push Signed Image
|
||||||
Enable Notary Client
|
Body Of Admin Push Signed Image
|
||||||
|
|
||||||
${rc} ${output}= Run And Return Rc And Output docker pull hello-world:latest
|
|
||||||
Log ${output}
|
|
||||||
|
|
||||||
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world:latest
|
|
||||||
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${notaryServerEndpoint}
|
|
||||||
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 - Retag A Image Tag
|
Test Case - Retag A Image Tag
|
||||||
Init Chrome Driver
|
Init Chrome Driver
|
||||||
|
36
tests/robot-cases/Group1-Nightly/Upgrade.robot
Normal file
36
tests/robot-cases/Group1-Nightly/Upgrade.robot
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
*** Settings ***
|
||||||
|
Documentation Harbor BATs
|
||||||
|
Resource ../../resources/Util.robot
|
||||||
|
Default Tags Nightly
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${HARBOR_URL} https://${ip}
|
||||||
|
${SSH_USER} root
|
||||||
|
${HARBOR_ADMIN} admin
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
Test Case - Manage project publicity
|
||||||
|
Body Of Manage project publicity
|
||||||
|
|
||||||
|
Test Case - Scan A Tag In The Repo
|
||||||
|
Body Of Scan A Tag In The Repo
|
||||||
|
|
||||||
|
Test Case - List Helm Charts
|
||||||
|
Body Of List Helm Charts
|
||||||
|
|
||||||
|
Test Case - Admin Push Signed Image
|
||||||
|
Body Of Admin Push Signed Image
|
Loading…
Reference in New Issue
Block a user