Merge pull request #16760 from YangJiao0817/add-imgpkg-copy-testcase

Add imgpkg copy test case
This commit is contained in:
Yang Jiao 2022-05-10 16:17:50 +08:00 committed by GitHub
commit 2563cf1bfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 9 deletions

View File

@ -44,3 +44,6 @@ Check Scan Artifact Job Status Is Stopped
Wait Until Element Is Visible ${stopped_label}
${job_status}= Get Text ${stopped_label}
Should Be Equal As Strings '${job_status}' 'Scan stopped'
Refresh Repositories
Retry Element Click ${refresh_repositories_xpath}

View File

@ -25,3 +25,4 @@ ${push_image_command_btn} //hbr-push-image-button//button
${scan_artifact_btn} //button[@id='scan-btn']
${stop_scan_artifact_btn} //button[@id='stop-scan']
${stopped_label} //span[@class='label stopped']
${refresh_repositories_xpath} //hbr-repository-gridview//span[contains(@class,'refresh-btn')]

View File

@ -0,0 +1,39 @@
# 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 provides helper functions for docker operations
Library OperatingSystem
Library Process
*** Keywords ***
Imgpkg Push
[Arguments] ${server} ${project} ${repository} ${tag} ${directory}
Wait Unitl Command Success imgpkg push -b ${server}/${project}/${repository}:${tag} -f ${directory}
Imgpkg Pull
[Arguments] ${server} ${project} ${repository} ${tag} ${directory}
Wait Unitl Command Success imgpkg pull -b ${server}/${project}/${repository}:${tag} -o ${directory}
Imgpkg Copy From Registry To Registry
[Arguments] ${source_registry} ${target_repo}
Wait Unitl Command Success imgpkg copy -b ${source_registry} --to-repo=${target_repo}
Imgpkg Copy From Registry To Local Tarball
[Arguments] ${source_registry} ${file_path}
Wait Unitl Command Success imgpkg copy -b ${source_registry} --to-tar=${file_path}
Imgpkg Copy From Local Tarball To Registry
[Arguments] ${file_path} ${target_repo}
Wait Unitl Command Success imgpkg copy --tar ${file_path} --to-repo=${target_repo}

View File

@ -75,6 +75,7 @@ Resource SeleniumUtil.robot
Resource Nightly-Util.robot
Resource APITest-Util.robot
Resource Cosign_Util.robot
Resource Imgpkg-Util.robot
Resource TestCaseBody.robot
*** Keywords ***

View File

@ -880,17 +880,19 @@ Test Case - WASM Push And Pull To Harbor
Test Case - Carvel Imgpkg Push And Pull To Harbor
[Tags] imgpkg_push_and_pull
Init Chrome Driver
${user}= Set Variable user004
${pwd}= Set Variable Test1@34
${out_path}= Set Variable /tmp/my-bundle
${user}= Set Variable user004
${pwd}= Set Variable Test1@34
${out_path}= Set Variable /tmp/my-bundle
${repository}= Set Variable my-bundle
${tag}= Set Variable v1.0.0
Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
${d}= Get Current Date result_format=%m%s
${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project project${d}
Prepare Image Package Test Files ${EXECDIR}/config
Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
Wait Unitl Command Success imgpkg push -b ${ip}/project${d}/my-bundle:v1.0.0 -f config/
Wait Unitl Command Success imgpkg pull -b ${ip}/project${d}/my-bundle:v1.0.0 -o ${out_path}
Wait Unitl Command Success docker logout ${ip}
Docker Login ${ip} ${user} ${pwd}
Imgpkg Push ${ip} project${d} ${repository} ${tag} ${EXECDIR}/config
Imgpkg Pull ${ip} project${d} ${repository} ${tag} ${out_path}
Docker Logout ${ip}
Retry File Should Exist ${out_path}/.imgpkg/bundle.yml
Retry File Should Exist ${out_path}/.imgpkg/images.yml

View File

@ -849,3 +849,40 @@ Test Case - Enable Replication Of Cosign And Notary Deployment Security Policy
Back Project Home project_push_dest${d}
Retry Double Keywords When Error Go Into Repo project_push_dest${d}/${image2} Should Be Signed By Cosign ${tag2}
Close Browser
Test Case - Carvel Imgpkg Copy To Harbor
[Tags] imgpkg_copy
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${out_file_path}= Set Variable /tmp/my-bundle.tar
${repository}= Set Variable my-bundle
${tag}= Set Variable v1.0.0
Sign In Harbor https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d}
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project_dest${d}
Docker Login ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Docker Login ${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Prepare Image Package Test Files ${EXECDIR}/config
Imgpkg Push ${ip} project${d} ${repository} ${tag} ${EXECDIR}/config
Imgpkg Copy From Registry To Registry ${ip}/project${d}/${repository}:${tag} ${ip1}/project_dest${d}/${repository}
Refresh Repositories
Repo Exist project_dest${d} ${repository}
Go Into Repo project_dest${d}/${repository}
Artifact Exist ${tag}
Back Project Home project_dest${d}
Delete Repo project_dest${d} ${repository}
Repo Not Exist project_dest${d} ${repository}
Imgpkg Copy From Registry To Local Tarball ${ip}/project${d}/${repository}:${tag} ${out_file_path}
Retry File Should Exist ${out_file_path}
Imgpkg Copy From Local Tarball To Registry ${out_file_path} ${ip1}/project_dest${d}/${repository}
Refresh Repositories
Repo Exist project_dest${d} ${repository}
Retry Element Click ${repo_search_icon}
Go Into Repo project_dest${d}/${repository}
Artifact Exist ${tag}
Docker Logout ${ip}
Docker Logout ${ip1}
Close Browser