From fdded0744ab9a4d86b080bc6e633c8ab6363f912 Mon Sep 17 00:00:00 2001 From: danfengliu Date: Mon, 20 Apr 2020 17:16:02 +0800 Subject: [PATCH] Clean up gitaction env and add tag for pytest 1. Add docker prune cmd to release some space; 2. Add tag for pytest in case of debugging requirement; 3. Replace image to smaller size in robot account pytest; Signed-off-by: danfengliu --- tests/apitests/python/test_robot_account.py | 2 +- tests/ci/api_common_install.sh | 1 + tests/ci/api_run.sh | 5 +++- tests/robot-cases/Group0-BAT/API_DB.robot | 28 ++++++++++++++++++++- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/tests/apitests/python/test_robot_account.py b/tests/apitests/python/test_robot_account.py index 5a6a7c7b6..9c78abbbe 100644 --- a/tests/apitests/python/test_robot_account.py +++ b/tests/apitests/python/test_robot_account.py @@ -71,7 +71,7 @@ class TestProjects(unittest.TestCase): image_project_a = "haproxy" image_project_b = "hello-world" image_project_c = "httpd" - image_robot_account = "mariadb" + image_robot_account = "alpine" tag = "latest" print "#1. Create user(UA);" diff --git a/tests/ci/api_common_install.sh b/tests/ci/api_common_install.sh index c4a3b2b04..cf70de1c1 100755 --- a/tests/ci/api_common_install.sh +++ b/tests/ci/api_common_install.sh @@ -4,6 +4,7 @@ set -x set +e sudo rm -fr /data/* sudo mkdir -p /data +docker system prune -a -f DIR="$(cd "$(dirname "$0")" && pwd)" set -e diff --git a/tests/ci/api_run.sh b/tests/ci/api_run.sh index 7f6c043b5..393c3f058 100755 --- a/tests/ci/api_run.sh +++ b/tests/ci/api_run.sh @@ -28,10 +28,13 @@ function uploader { set +e docker ps - +# Log storage space before running API_DB.robot +df -H # run db auth api cases if [ "$1" = 'DB' ]; then pybot -X -v ip:$2 -v HARBOR_PASSWORD:Harbor12345 $DIR/../../tests/robot-cases/Group0-BAT/API_DB.robot + # Log storage space after running API_DB.robot + df -H elif [ "$1" = 'LDAP' ]; then # run ldap api cases python $DIR/../../tests/configharbor.py -H $IP -u $HARBOR_ADMIN -p $HARBOR_ADMIN_PASSWD -c auth_mode=ldap_auth \ diff --git a/tests/robot-cases/Group0-BAT/API_DB.robot b/tests/robot-cases/Group0-BAT/API_DB.robot index 4288c1561..59d28b876 100644 --- a/tests/robot-cases/Group0-BAT/API_DB.robot +++ b/tests/robot-cases/Group0-BAT/API_DB.robot @@ -18,54 +18,80 @@ ${SERVER_API_ENDPOINT} ${SERVER_URL}/api *** Test Cases *** Test Case - Garbage Collection + [Tags] gc Harbor API Test ./tests/apitests/python/test_garbage_collection.py Test Case - Add Private Project Member and Check User Can See It + [Tags] private_member Harbor API Test ./tests/apitests/python/test_add_member_to_private_project.py Test Case - Delete a Repository of a Certain Project Created by Normal User + [Tags] del_repo Harbor API Test ./tests/apitests/python/test_del_repo.py Test Case - Add a System Global Label to a Certain Tag + [Tags] global_lbl Harbor API Test ./tests/apitests/python/test_add_sys_label_to_tag.py Test Case - Add Replication Rule + [Tags] replic_rule Harbor API Test ./tests/apitests/python/test_add_replication_rule.py Test Case - Edit Project Creation + [Tags] pro_creation Harbor API Test ./tests/apitests/python/test_edit_project_creation.py Test Case - Manage Project Member + [Tags] member Harbor API Test ./tests/apitests/python/test_manage_project_member.py Test Case - Project Level Policy Content Trust + [Tags] content_trust Harbor API Test ./tests/apitests/python/test_project_level_policy_content_trust.py Test Case - User View Logs + [Tags] view_logs Harbor API Test ./tests/apitests/python/test_user_view_logs.py Test Case - List Helm Charts + [Tags] list_helm_charts Harbor API Test ./tests/apitests/python/test_list_helm_charts.py Test Case - Assign Sys Admin + [Tags] assign_adin Harbor API Test ./tests/apitests/python/test_assign_sys_admin.py Test Case - Copy Artifact Outside Project + [Tags] copy_artifact Harbor API Test ./tests/apitests/python/test_copy_artifact_outside_project.py Test Case - Robot Account + [Tags] robot_account Harbor API Test ./tests/apitests/python/test_robot_account.py Test Case - Sign A Image + [Tags] sign_image Harbor API Test ./tests/apitests/python/test_sign_image.py Test Case - Project Quota - Harbor API Test ./tests/apitests/python/test_project_quota.py + [Tags] quota + Harbor API Test ./tests/apitests/python/test_project_quota.py Test Case - System Level CVE Whitelist + [Tags] sys_cve Harbor API Test ./tests/apitests/python/test_sys_cve_whitelists.py Test Case - Project Level CVE Whitelist + [Tags] pro_cve Harbor API Test ./tests/apitests/python/test_project_level_cve_whitelist.py Test Case - Tag Retention + [Tags] tag_retention Harbor API Test ./tests/apitests/python/test_retention.py Test Case - Health Check + [Tags] health Harbor API Test ./tests/apitests/python/test_health_check.py Test Case - Push Index By Docker Manifest + [Tags] push_index Harbor API Test ./tests/apitests/python/test_push_index_by_docker_manifest.py Test Case - Push Chart By Helm3 Chart CLI + [Tags] push_chart Harbor API Test ./tests/apitests/python/test_push_chart_by_helm3_chart_cli.py Test Case - Push Cnab Bundle + [Tags] push_cnab Harbor API Test ./tests/apitests/python/test_push_cnab_bundle.py Test Case - Create/Delete tag + [Tags] tag_cuid Harbor API Test ./tests/apitests/python/test_create_delete_tag.py Test Case - Scan Image + [Tags] scan Harbor API Test ./tests/apitests/python/test_scan_image_artifact.py Test Case - Scan All Images + [Tags] scan_all Harbor API Test ./tests/apitests/python/test_system_level_scan_all.py Test Case - Registry API + [Tags] reg_api Harbor API Test ./tests/apitests/python/test_registry_api.py