Add project level policy auto case

This commit is contained in:
myufei 2017-11-03 14:36:40 +08:00
parent 8dfe5f0bfc
commit c66ab0d142
4 changed files with 91 additions and 1 deletions

View File

@ -69,6 +69,14 @@ Cannot Pull image
Log ${output}
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
[Arguments] ${ip} ${user} ${pwd} ${project} ${image}
Log To Console \nRunning docker push ${image}...
@ -123,4 +131,4 @@ Kill Local Docker Daemon
Terminate Process ${handle}
Process Should Be Stopped ${handle}
${rc}= Run And Return Rc kill -9 ${dockerd-pid}
Should Be Equal As Integers ${rc} 0
Should Be Equal As Integers ${rc} 0

View 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']

View File

@ -45,3 +45,4 @@ Resource Admiral-Util.robot
Resource OVA-Util.robot
Resource Cert-Util.robot
Resource SeleniumUtil.robot
Resource Harbor-Pages/Project-Config.robot

View File

@ -137,6 +137,37 @@ Test Case - Manage project publicity
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}
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
# create normal user and login
Init Chrome Driver