mirror of
https://github.com/goharbor/harbor.git
synced 2024-06-23 21:35:04 +02:00
Add project level policy auto case
This commit is contained in:
parent
8dfe5f0bfc
commit
c66ab0d142
|
@ -69,6 +69,14 @@ Cannot Pull image
|
||||||
Log ${output}
|
Log ${output}
|
||||||
Should Not Be Equal As Integers ${rc} 0
|
Should Not Be Equal As Integers ${rc} 0
|
||||||
|
|
||||||
|
Cannot Pull Unsigned Image
|
||||||
|
[Arguments] ${ip} ${user} ${pass} ${proj} ${imagewithtag}
|
||||||
|
${rc} ${output}= Run And Return Rc And Output docker login -u ${user} -p ${pass} ${ip}
|
||||||
|
Should Be Equal As Integers ${rc} 0
|
||||||
|
${rc} ${output}= Run And Return Rc And Output docker pull ${ip}/${proj}/${imagewithtag}
|
||||||
|
Should Contain ${output} The image is not signed in Notary
|
||||||
|
Should Not Be Equal As Integers ${rc} 0
|
||||||
|
|
||||||
Cannot Push image
|
Cannot Push image
|
||||||
[Arguments] ${ip} ${user} ${pwd} ${project} ${image}
|
[Arguments] ${ip} ${user} ${pwd} ${project} ${image}
|
||||||
Log To Console \nRunning docker push ${image}...
|
Log To Console \nRunning docker push ${image}...
|
||||||
|
@ -123,4 +131,4 @@ Kill Local Docker Daemon
|
||||||
Terminate Process ${handle}
|
Terminate Process ${handle}
|
||||||
Process Should Be Stopped ${handle}
|
Process Should Be Stopped ${handle}
|
||||||
${rc}= Run And Return Rc kill -9 ${dockerd-pid}
|
${rc}= Run And Return Rc kill -9 ${dockerd-pid}
|
||||||
Should Be Equal As Integers ${rc} 0
|
Should Be Equal As Integers ${rc} 0
|
||||||
|
|
50
tests/resources/Harbor-Pages/Project-Config.robot
Normal file
50
tests/resources/Harbor-Pages/Project-Config.robot
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
*** Settings ***
|
||||||
|
|
||||||
|
Resource ../../resources/Util.robot
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${HARBOR_VERSION} V1.1.1
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
|
||||||
|
Goto Project Config
|
||||||
|
Click Element //project-detail//ul/li[contains(.,'Configuration')]
|
||||||
|
|
||||||
|
Click Project Public
|
||||||
|
Mouse Down //hbr-project-policy-config//input[@name='public']
|
||||||
|
Mouse Up //hbr-project-policy-config//input[@name='public']
|
||||||
|
|
||||||
|
Click Content Trust
|
||||||
|
Mouse Down //hbr-project-policy-config//input[@name='content-trust']
|
||||||
|
Mouse Up //hbr-project-policy-config//input[@name='content-trust']
|
||||||
|
|
||||||
|
Click Prevent Running
|
||||||
|
Mouse Down //hbr-project-policy-config//input[@name='prevent-vulnerability-image']
|
||||||
|
Mouse Up //hbr-project-policy-config//input[@name='prevent-vulnerability-image']
|
||||||
|
|
||||||
|
Select Prevent Level
|
||||||
|
#value NEGLIGIBLE LOW MEDIUM HIGH
|
||||||
|
[Arguments] ${level}
|
||||||
|
Click Element //hbr-project-policy-config//select
|
||||||
|
Click Element //hbr-project-policy-config//select/option[contains(.,'${level}')]
|
||||||
|
Click Auto Scan
|
||||||
|
Mouse Down //hbr-project-policy-config//input[@name='scan-image-on-push']
|
||||||
|
Mouse Up //hbr-project-policy-config//input[@name='scan-image-on-push']
|
||||||
|
|
||||||
|
Save Project Config
|
||||||
|
Sleep 1
|
||||||
|
Click Element //hbr-project-policy-config//button[contains(.,'SAVE')]
|
||||||
|
|
||||||
|
#assert
|
||||||
|
Public Should Be Selected
|
||||||
|
Checkbox Should Be Selected //hbr-project-policy-config//input[@name='public']
|
||||||
|
Project Should Be Public
|
||||||
|
[Arguments] ${projid}
|
||||||
|
Page Should Contain Element //clr-dg-row-master[contains(.,'${projid}')]//clr-dg-cell[contains(.,'Public')]
|
||||||
|
Content Trust Should Be Selected
|
||||||
|
Checkbox Should Be Selected //hbr-project-policy-config//input[@name='content-trust']
|
||||||
|
Prevent Running Should Be Selected
|
||||||
|
Checkbox Should Be Selected //hbr-project-policy-config//input[@name='prevent-vulnerability-image']
|
||||||
|
Auto Scan Should Be Selected
|
||||||
|
Checkbox Should Be Selected //hbr-project-policy-config//input[@name='scan-image-on-push']
|
||||||
|
|
|
@ -45,3 +45,4 @@ Resource Admiral-Util.robot
|
||||||
Resource OVA-Util.robot
|
Resource OVA-Util.robot
|
||||||
Resource Cert-Util.robot
|
Resource Cert-Util.robot
|
||||||
Resource SeleniumUtil.robot
|
Resource SeleniumUtil.robot
|
||||||
|
Resource Harbor-Pages/Project-Config.robot
|
||||||
|
|
|
@ -137,6 +137,37 @@ Test Case - Manage project publicity
|
||||||
Project Should Display project${d}
|
Project Should Display project${d}
|
||||||
Close Browser
|
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}
|
||||||
|
Go Into Project project${d}
|
||||||
|
Goto Project Config
|
||||||
|
Click Project Public
|
||||||
|
Save Project Config
|
||||||
|
#verify
|
||||||
|
Public Should Be Selected
|
||||||
|
Back To Projects
|
||||||
|
#project${d} default should be private
|
||||||
|
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
|
||||||
|
#verify
|
||||||
|
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
|
Test Case - Edit Project Creation
|
||||||
# create normal user and login
|
# create normal user and login
|
||||||
Init Chrome Driver
|
Init Chrome Driver
|
||||||
|
|
Loading…
Reference in New Issue
Block a user