mirror of
https://github.com/goharbor/harbor
synced 2025-04-07 19:31:30 +00:00
Add data verify robot case after upgrade (#5207)
Add data verify e2e case after upgrade
This commit is contained in:
parent
de7b10c9f3
commit
889b36a944
150
tests/resources/Harbor-Pages/Verify.robot
Normal file
150
tests/resources/Harbor-Pages/Verify.robot
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
*** settings ***
|
||||||
|
Library JSONLibrary
|
||||||
|
Resource ../../resources/Util.robot
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
#for jsonpath refer to http://goessner.net/articles/JsonPath/ or https://nottyo.github.io/robotframework-jsonlibrary/JSONLibrary.html
|
||||||
|
|
||||||
|
${json}= Load Json From File testdata.json
|
||||||
|
|
||||||
|
Verify User
|
||||||
|
@{user}= Get Value From Json ${json} $.users..name
|
||||||
|
#verify user exist
|
||||||
|
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD}
|
||||||
|
Switch To User Tag
|
||||||
|
:For ${user} In @{user}
|
||||||
|
\ Page Should Contain ${user}
|
||||||
|
Logout Harbor
|
||||||
|
#verify user can login
|
||||||
|
:For ${user} In @{user}
|
||||||
|
\ Sign In Harbor ${HARBOR_URL} ${user} %{HARBOR_PASSWORD}
|
||||||
|
\ Logout Harbor
|
||||||
|
|
||||||
|
Verify Project
|
||||||
|
@{project}= Get Value From Json ${json} $.projects.[*].name
|
||||||
|
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD}
|
||||||
|
:For ${project} In @{project}
|
||||||
|
\ Page Should Contain ${project}
|
||||||
|
|
||||||
|
Verify Image Tag
|
||||||
|
@{project}= Get Value From Json ${json} $.projects.[*].name
|
||||||
|
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD}
|
||||||
|
:For ${project} In @{projects}
|
||||||
|
\ Go Into Project ${project}
|
||||||
|
\ @{repo}= Get Value From Json ${json} $.projects[?(@name=${project})]..repo..name
|
||||||
|
\ @{tag}= Get Value From Json ${json} $.projects[?(@name=${project})]..repo..tag
|
||||||
|
\ :For ${repo} In @{repo}
|
||||||
|
\ \ Go Into Repo ${repo}
|
||||||
|
\ \ :For ${tag} In @{tag}
|
||||||
|
\ \ \ Page Should Contain ${tag}
|
||||||
|
\ \ \ Back To Projects
|
||||||
|
|
||||||
|
Verify Member Exist
|
||||||
|
@{project}= Get Value From Json ${json} $.projects.[*].name
|
||||||
|
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HAROBR_PASSWORD}
|
||||||
|
:For ${project} In @{project}
|
||||||
|
\ Go Into Project ${projet}
|
||||||
|
\ Switch To Member
|
||||||
|
\ @{members}= Get Value From Json ${json} $.projects[?(@name=${project})].member..name
|
||||||
|
\ :For ${member} In @{members}
|
||||||
|
\ \ Page Should Contain ${member}
|
||||||
|
\ Back To Projects
|
||||||
|
|
||||||
|
Verify User System Admin Role
|
||||||
|
@{user}= Get Value From Json ${json} $.admin..name
|
||||||
|
:For ${user} in @{user}
|
||||||
|
\ Sign In Harbor ${HARBOR_URL} ${user} %{HARBOR_PASSWORD}
|
||||||
|
\ Page Should Contain Administration
|
||||||
|
\ Logout Harbor
|
||||||
|
|
||||||
|
Verify System Label
|
||||||
|
@{label}= Get Value From Json ${json} $..syslabel..name
|
||||||
|
Sign In Harbor ${HAROBR_URL} %{HAROBR_ADMIN} %{HAROBR_PASSWORD}
|
||||||
|
Switch To Configure
|
||||||
|
Switch To System Labels
|
||||||
|
:For ${label} In @{label}
|
||||||
|
\ Page Should Contain ${label}
|
||||||
|
|
||||||
|
Verify Project Label
|
||||||
|
@{project}= Get Value From Json ${json} $.peoject.[*].name
|
||||||
|
Sign In Harbor ${HAROBR_URL} %{HAROBR_ADMIN} %{HAROBR_PASSWORD}
|
||||||
|
:For ${project} In @{project}
|
||||||
|
\ Go Into Project ${project}
|
||||||
|
\ Switch To Project Label
|
||||||
|
\ @{projectlabel}= Get Value From Json ${json} $.projects[?(@.name=${project})]..labels..name
|
||||||
|
\ :For ${label} In @{projectlabel}
|
||||||
|
\ \ Page Should Contain ${projectlabel}
|
||||||
|
\ Back To Projects
|
||||||
|
|
||||||
|
Verify Endpoint
|
||||||
|
@{endpoint}= Get Value From Json ${json} $.endpoint..name
|
||||||
|
Sign In Harbor ${HAROBR_URL} %{HAROBR_ADMIN} %{HAROBR_PASSWORD}
|
||||||
|
Switch To Registries
|
||||||
|
:For ${endpoint} In @{endpoint}
|
||||||
|
\ Page Should Contain ${endpoint}
|
||||||
|
|
||||||
|
Verify Replicationrule
|
||||||
|
@{replicationrule}= Get Value From Json ${json} $.replicationrule..name
|
||||||
|
Sign In Harbor ${HAROBR_URL} %{HAROBR_ADMIN} %{HAROBR_PASSWORD}
|
||||||
|
Switch To System Replication
|
||||||
|
:For ${replicationrule} In @{replicationrule}
|
||||||
|
\ Page Should Contain ${replicationrule}
|
||||||
|
|
||||||
|
Verify Project Setting
|
||||||
|
@{projects}= Get Value From Json ${json} $.projects.[*].name
|
||||||
|
:For ${project} In @{projects}
|
||||||
|
\ ${public}= Get Value From Json ${json} $.projects[?(@.name=${projectname})].accesslevel
|
||||||
|
\ ${contenttrust}= Get Value From Json ${json} $.projects[?(@.name=${projectname})]..enable_content_trust
|
||||||
|
\ ${preventrunning}= Get Value From Json ${json} $.projects[?(@.name=${projectname})]..prevent_vulnerable_images_from_running
|
||||||
|
\ ${scanonpush}= Get Value From Json ${json} $.projects[?(@.name=${projectname})]..automatically_scan_images_on_push
|
||||||
|
\ Sign In Harbor ${HAROBR_URL} %{HAROBR_ADMIN} %{HAROBR_PASSWORD}
|
||||||
|
\ Go Into Project ${project}
|
||||||
|
\ Goto Project Config
|
||||||
|
\ Run Keyword If ${public} == "public"
|
||||||
|
\ Checkbox Should Be Checked //clr-checkbox[@name='public']//label
|
||||||
|
\ Else
|
||||||
|
\ Checkbox Should Not Be Checked //clr-checkbox[@name='public']//label
|
||||||
|
\ Run Keyword If ${contenttrust} == "true"
|
||||||
|
\ Checkbox Should Be Checked //clr-checkbox[@name='content-trust']//label
|
||||||
|
\ Else
|
||||||
|
\ Checkbox Should Not Be Checked //clr-checkbox[@name='content-trust']//label
|
||||||
|
\ Run Keyword If ${preventrunning} == "true"
|
||||||
|
\ Checkbox Should Be Checked //clr-checkbox[@name='prevent-vulenrability-image']//label
|
||||||
|
\ #verify level?page should not contain disabled element
|
||||||
|
\ Else
|
||||||
|
\ Checkbox Should Not Be Checked //clr-checkbox[@name='prevent-vulenrability-image']//label
|
||||||
|
\ #Page Should Contain a disabled element
|
||||||
|
\ Run Keyword If ${scanonpush} == "true"
|
||||||
|
\ Checkbox Should Be Checked //clr-checkbox[@name='scan-image-on-push']//label
|
||||||
|
\ Else
|
||||||
|
\ Checkbox Should Not Be Checked //clr-checkbox[@name='scan-image-on-push']//label
|
||||||
|
\ Back To Projects
|
||||||
|
|
||||||
|
Verify System Setting
|
||||||
|
${authtype}= Get Value From Json ${json} $.configuration.authmode
|
||||||
|
${creation}= Get Value From Json ${json} $.configuration..projectcreation
|
||||||
|
${selfreg}= Get Value From Json ${json} $.configuration..selfreg
|
||||||
|
${emailserver}= Get Value From Json ${json} $.configuration..emailserver
|
||||||
|
${emailport}= Get Value From Json ${json} $.configuration..emailport
|
||||||
|
${emailuser}= Get Value From Json ${json} $.configuration..emailuser
|
||||||
|
${emailfrom}= Get Value From Json ${json} $.configuration..emailfrom
|
||||||
|
${token}= Get Value From Json ${json} $.configuration..token
|
||||||
|
${scanschedule}= Get Value From Json ${json} $.configuration..scanall
|
||||||
|
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD}
|
||||||
|
Switch To Configure
|
||||||
|
Page Should Contain ${authtype}
|
||||||
|
Run Keyword If ${selfreg} == "True"
|
||||||
|
Checkbox Should Be Checked //clr-checkbox[@id='selfReg']//label
|
||||||
|
Else
|
||||||
|
Checkbox Should Not Be Checked //clr-checkbox[@id='selfReg']//label
|
||||||
|
Page Should Contain ${creation}
|
||||||
|
Switch To Email
|
||||||
|
Page Should Contain ${emailserver}
|
||||||
|
Page Should Contain ${emailport}
|
||||||
|
Page Should Contain ${emailuser}
|
||||||
|
Page Should Contain ${emailfrom}
|
||||||
|
Switch To System Settings
|
||||||
|
Page Should Contain ${token}
|
||||||
|
Go To Vulnerability Config
|
||||||
|
Page Should Contain ${scanschedule}
|
||||||
|
|
|
@ -21,6 +21,7 @@ Library Process
|
||||||
Library SSHLibrary 1 minute
|
Library SSHLibrary 1 minute
|
||||||
Library DateTime
|
Library DateTime
|
||||||
Library Selenium2Library 10 10
|
Library Selenium2Library 10 10
|
||||||
|
Library JSONLibrary
|
||||||
Resource Nimbus-Util.robot
|
Resource Nimbus-Util.robot
|
||||||
Resource Vsphere-Util.robot
|
Resource Vsphere-Util.robot
|
||||||
Resource VCH-Util.robot
|
Resource VCH-Util.robot
|
||||||
|
@ -52,3 +53,4 @@ Resource Cert-Util.robot
|
||||||
Resource SeleniumUtil.robot
|
Resource SeleniumUtil.robot
|
||||||
Resource Harbor-Pages/Project-Config.robot
|
Resource Harbor-Pages/Project-Config.robot
|
||||||
Resource Nightly-Util.robot
|
Resource Nightly-Util.robot
|
||||||
|
Resource Harbor-Pages/Verify.robot
|
||||||
|
|
30
tests/robot-cases/Group13-Upgrade/Verifydata.robot
Normal file
30
tests/robot-cases/Group13-Upgrade/Verifydata.robot
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
*** Settings ***
|
||||||
|
Documentation Harbor BATs
|
||||||
|
Resource ../../resources/Util.robot
|
||||||
|
Suite Setup Nightly Test Setup ${ip} ${SSH_PWD} ${HARBOR_PASSWORD} ${ip1}
|
||||||
|
Suite Teardown Collect Nightly Logs ${ip} ${SSH_PWD} ${ip1}
|
||||||
|
Default Tags Nightly
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${HARBOR_URL} https://${ip}
|
||||||
|
${SSH_USER} root
|
||||||
|
${HARBOR_ADMIN} admin
|
||||||
|
|
||||||
|
*** test case ***
|
||||||
|
|
||||||
|
Verify Data
|
||||||
|
#get version from extenal argument
|
||||||
|
Convert To Float ${version}
|
||||||
|
Run Keyword If ${version}==1.1
|
||||||
|
Run Keywords Verify User Verify Project Verify Member Exist Verify Image Tag Verify Endpoint Verify Replicationrule
|
||||||
|
Else If ${version}==1.2
|
||||||
|
Run Keywords Verify User Verify Project Verify Member Exist Verify Image Tag Verify Endpoint Verify Replicationrule
|
||||||
|
Else If ${version}==1.3
|
||||||
|
Run Keywords Verify User Verify Project Verify Member Exist Verify Image Tag Verify Endpoint Verify Replicationrule Verify System Setting Verify Project Setting
|
||||||
|
Else If ${version}==1.4
|
||||||
|
Run Keywords Verify User Verify Project Verify Member Exist Verify Image Tag Verify Endpoint Verify Replicationrule Verify System Setting Verify Project Setting
|
||||||
|
Else If ${version}==1.5
|
||||||
|
Run Keywords Verify User Verify Project Verify Member Exist Verify Image Tag Verify Endpoint Verify Replicationrule Verify System Setting Verify Project Setting Verify Project Label Verify Syslabel
|
||||||
|
Else
|
||||||
|
Log To Consle "Version Not Supported"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user