Add replication test cases triggered by events (#16466)

Signed-off-by: Yang Jiao <jiaoya@vmware.com>
This commit is contained in:
Yang Jiao 2022-03-04 14:11:57 +08:00 committed by GitHub
parent 1c4495361b
commit 62afa16b57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 113 additions and 3 deletions

View File

@ -376,9 +376,13 @@ Select Storage Quota unit
[Arguments] ${unit}
Select From List By Value ${project_add_storage_quota_unit_id} ${unit}
Back Project Home
[Arguments] ${project_name}
Retry Link Click //a[contains(.,'${project_name}')]
Should Not Be Signed By Cosign
[Arguments] ${tag}
Retry Wait Element Visible //clr-dg-row[contains(.,'latest')]//clr-icon[contains(@class,'color-red')]
Retry Wait Element Visible //clr-dg-row[contains(.,'${tag}')]//clr-icon[contains(@class,'color-red')]
Should Be Signed By Cosign
[Arguments] ${tag}
@ -388,7 +392,7 @@ Delete Accessory
[Arguments] ${tag}
Retry Button Click //clr-dg-row[contains(.,'${tag}')]//button[contains(@class,'datagrid-expandable-caret-button')]
Retry Button Click //clr-dg-row[contains(.,'${tag}')]//button[contains(@class,'datagrid-action-toggle')]
Retry Button Click //div[@id='clr-action-menu1']/button[@class='action-item']
Retry Button Click //button[contains(.,'Delete')]
Retry Button Click //div[contains(@class,'modal-content')]//button[contains(@class,'btn-danger')]
Should be Accessory deleted

View File

@ -438,4 +438,110 @@ Test Case - Robot Account Do Replication
Should Be Signed By Cosign ${tag1}
Image Should Be Replicated To Project project_dest${d} ${image2} period=0
Should Be Signed By Cosign ${tag2}
Close Browser
Close Browser
Test Case - Replication Triggered By Events
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${image1}= Set Variable hello-world
${tag1}= Set Variable latest
${image1sha256}= Set Variable sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a
${image1_short_sha256}= Get Substring ${image1sha256} 0 15
${image2}= Set Variable busybox
${tag2}= Set Variable latest
${image2sha256}= Set Variable sha256:34efe68cca33507682b1673c851700ec66839ecf94d19b928176e20d20e02413
${image2_short_sha256}= Get Substring ${image2sha256} 0 15
${index}= Set Variable index
${index_tag}= Set Variable index_tag
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project_dest${d}
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d}
Switch To Registries
Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule_push_${d} push project${d}/* image e${d} project_dest${d} mode=Event Based del_remote=${true}
# push
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image1}:${tag1}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image2}:${tag2}
Docker Push Index ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${ip}/project${d}/${index}:${index_tag} ${ip}/project${d}/${image1}:${tag1} ${ip}/project${d}/${image2}:${tag2}
Go Into Project project${d}
Wait Until Page Contains project${d}/${image1}
Wait Until Page Contains project${d}/${image2}
Wait Until Page Contains project${d}/${index}
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Image Should Be Replicated To Project project_dest${d} ${image1} period=0
Image Should Be Replicated To Project project_dest${d} ${image2} period=0
Image Should Be Replicated To Project project_dest${d} ${index} period=0
# sign
Cosign Generate Key Pair
Docker Login ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Cosign Sign ${ip}/project${d}/${image1}:${tag1}
Cosign Sign ${ip}/project${d}/${index}:${index_tag}
Cosign Sign ${ip}/project${d}/${index}@${image1sha256}
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project project${d}
Retry Double Keywords When Error Go Into Repo project${d}/${image1} Should Be Signed By Cosign ${tag1}
Back Project Home project${d}
Retry Double Keywords When Error Go Into Repo project${d}/${index} Should Be Signed By Cosign ${index_tag}
Back Project Home project${d}
Go Into Repo project${d}/${index}
Retry Double Keywords When Error Click Index Achieve ${index_tag} Should Be Signed By Cosign ${image1_short_sha256}
Back Project Home project${d}
Retry Double Keywords When Error Go Into Repo project${d}/${image2} Should Not Be Signed By Cosign ${tag2}
Back Project Home project${d}
Go Into Repo project${d}/${index}
Retry Double Keywords When Error Click Index Achieve ${index_tag} Should Not Be Signed By Cosign ${image2_short_sha256}
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project project_dest${d}
Retry Double Keywords When Error Go Into Repo project_dest${d}/${image1} Should Be Signed By Cosign ${tag1}
Back Project Home project_dest${d}
Retry Double Keywords When Error Go Into Repo project_dest${d}/${index} Should Be Signed By Cosign ${index_tag}
Back Project Home project_dest${d}
Go Into Repo project_dest${d}/${index}
Retry Double Keywords When Error Click Index Achieve ${index_tag} Should Be Signed By Cosign ${image1_short_sha256}
Back Project Home project_dest${d}
Retry Double Keywords When Error Go Into Repo project_dest${d}/${image2} Should Not Be Signed By Cosign ${tag2}
Back Project Home project_dest${d}
Go Into Repo project_dest${d}/${index}
Retry Double Keywords When Error Click Index Achieve ${index_tag} Should Not Be Signed By Cosign ${image2_short_sha256}
Logout Harbor
# delete
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project project${d}
Delete Repo project${d} ${image2}
Repo Not Exist project${d} ${image2}
Go Into Project project${d}
Go Into Repo project${d}/${image1}
Retry Double Keywords When Error Delete Accessory ${tag1} Should be Accessory deleted ${tag1}
Should Not Be Signed By Cosign ${tag1}
Back Project Home project${d}
Go Into Repo project${d}/${index}
Retry Double Keywords When Error Delete Accessory ${index_tag} Should be Accessory deleted ${index_tag}
Should Not Be Signed By Cosign ${index_tag}
Click Index Achieve ${index_tag}
Retry Double Keywords When Error Delete Accessory ${image1_short_sha256} Should be Accessory deleted ${image1_short_sha256}
Should Not Be Signed By Cosign ${image1_short_sha256}
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project project_dest${d}
Go Into Repo project_dest${d}/${image2}
Wait Until Page Contains We couldn't find any artifacts!
Back Project Home project_dest${d}
Retry Double Keywords When Error Go Into Repo project_dest${d}/${image1} Should be Accessory deleted ${tag1}
Should Not Be Signed By Cosign ${tag1}
Back Project Home project_dest${d}
Retry Double Keywords When Error Go Into Repo project_dest${d}/${index} Should be Accessory deleted ${index_tag}
Should Not Be Signed By Cosign ${index_tag}
Retry Double Keywords When Error Click Index Achieve ${index_tag} Should be Accessory deleted ${image1_short_sha256}
Should Not Be Signed By Cosign ${image1_short_sha256}
Close Browser