From 30b8f0b9a1017366e095d0e0984ea0da91908c06 Mon Sep 17 00:00:00 2001 From: baijing <799286817@qq.com> Date: Thu, 31 Aug 2023 18:38:01 +0800 Subject: [PATCH 1/4] add eulermaker test --- .../data/json/build_single-all-params.json | 26 +++++++ .../json/build_single-no-architecture.json | 14 ++++ .../data/json/build_single-no-build-id.json | 15 ++++ .../json/build_single-no-ground-projects.json | 14 ++++ .../data/json/build_single-no-os-variant.json | 14 ++++ .../json/build_single-no-snapshot-id.json | 14 ++++ .../ebs-test/data/json/build_targets.json | 13 ++++ .../data/json/build_targets_error.json | 15 ++++ .../data/json/build_targets_include.json | 15 ++++ .../json/build_targets_include_snapshot.json | 13 ++++ .../data/json/build_targets_snapshot.json | 15 ++++ .../build_targets_snapshot_noinclude.json | 15 ++++ testcases/ebs-test/data/json/del.json | 3 + .../data/json/project-all-params.json | 67 +++++++++++++++++ .../data/yaml/build_single-all-params.yaml | 6 ++ .../yaml/build_single-no-architecture.yaml | 9 +++ .../data/yaml/build_single-no-build-id.yaml | 9 +++ .../yaml/build_single-no-ground-projects.yaml | 8 ++ .../data/yaml/build_single-no-os-variant.yaml | 9 +++ .../yaml/build_single-no-snapshot-id.yaml | 9 +++ .../ebs-test/data/yaml/build_targets.yaml | 3 + .../data/yaml/snapshot-all-params.yaml | 2 + .../data/yaml/snapshot-no-is-trunk.yaml | 1 + .../data/yaml/snapshot-no-prev-snapshot.yaml | 1 + .../oe_test_ebs_build_single_01.sh | 74 +++++++++++++++++++ .../oe_test_ebs_create_snapshot_01.sh | 74 +++++++++++++++++++ 26 files changed, 458 insertions(+) create mode 100644 testcases/ebs-test/data/json/build_single-all-params.json create mode 100644 testcases/ebs-test/data/json/build_single-no-architecture.json create mode 100644 testcases/ebs-test/data/json/build_single-no-build-id.json create mode 100644 testcases/ebs-test/data/json/build_single-no-ground-projects.json create mode 100644 testcases/ebs-test/data/json/build_single-no-os-variant.json create mode 100644 testcases/ebs-test/data/json/build_single-no-snapshot-id.json create mode 100644 testcases/ebs-test/data/json/build_targets.json create mode 100644 testcases/ebs-test/data/json/build_targets_error.json create mode 100644 testcases/ebs-test/data/json/build_targets_include.json create mode 100644 testcases/ebs-test/data/json/build_targets_include_snapshot.json create mode 100644 testcases/ebs-test/data/json/build_targets_snapshot.json create mode 100644 testcases/ebs-test/data/json/build_targets_snapshot_noinclude.json create mode 100644 testcases/ebs-test/data/json/del.json create mode 100644 testcases/ebs-test/data/json/project-all-params.json create mode 100644 testcases/ebs-test/data/yaml/build_single-all-params.yaml create mode 100644 testcases/ebs-test/data/yaml/build_single-no-architecture.yaml create mode 100644 testcases/ebs-test/data/yaml/build_single-no-build-id.yaml create mode 100644 testcases/ebs-test/data/yaml/build_single-no-ground-projects.yaml create mode 100644 testcases/ebs-test/data/yaml/build_single-no-os-variant.yaml create mode 100644 testcases/ebs-test/data/yaml/build_single-no-snapshot-id.yaml create mode 100644 testcases/ebs-test/data/yaml/build_targets.yaml create mode 100644 testcases/ebs-test/data/yaml/snapshot-all-params.yaml create mode 100644 testcases/ebs-test/data/yaml/snapshot-no-is-trunk.yaml create mode 100644 testcases/ebs-test/data/yaml/snapshot-no-prev-snapshot.yaml create mode 100755 testcases/ebs-test/oe_test_ebs_build_single/oe_test_ebs_build_single_01.sh create mode 100755 testcases/ebs-test/oe_test_ebs_create_snapshot/oe_test_ebs_create_snapshot_01.sh diff --git a/testcases/ebs-test/data/json/build_single-all-params.json b/testcases/ebs-test/data/json/build_single-all-params.json new file mode 100644 index 000000000..f2b7483e6 --- /dev/null +++ b/testcases/ebs-test/data/json/build_single-all-params.json @@ -0,0 +1,26 @@ +{ + "build_targets": [ + { + "os_variant": "openEuler:22.03-LTS-SP2", + "flags": { + "build": true, + "publish": true + }, + "ground_projects": [ + + ], + "architecture": "aarch64" + }, + { + "os_variant": "openEuler:22.03-LTS-SP1", + "flags": { + "build": true, + "publish": true + }, + "ground_projects": [ + + ], + "architecture": "x86_64" + } + ] +} diff --git a/testcases/ebs-test/data/json/build_single-no-architecture.json b/testcases/ebs-test/data/json/build_single-no-architecture.json new file mode 100644 index 000000000..9fcc52ec5 --- /dev/null +++ b/testcases/ebs-test/data/json/build_single-no-architecture.json @@ -0,0 +1,14 @@ +{ + "build_targets": [ + { + "os_variant": "openEuler:22.09", + "ground_projects": ["openEuler:22.09-BaseOS-0913-2230"], + "flag": { + "build": true, + "publish": true + } + } + ], + "snapshot_id": "", + "build_id": "" +} diff --git a/testcases/ebs-test/data/json/build_single-no-build-id.json b/testcases/ebs-test/data/json/build_single-no-build-id.json new file mode 100644 index 000000000..e63e5626f --- /dev/null +++ b/testcases/ebs-test/data/json/build_single-no-build-id.json @@ -0,0 +1,15 @@ +{ + "build_targets": [ + { + "os_variant": "openEuler:22.09", + "architecture": "aarch64", + "ground_projects": ["openEuler:22.09-BaseOS-0913-2230"], + "flag": { + "build": true, + "publish": true + } + + } + ], + "snapshot_id": "" +} diff --git a/testcases/ebs-test/data/json/build_single-no-ground-projects.json b/testcases/ebs-test/data/json/build_single-no-ground-projects.json new file mode 100644 index 000000000..fd9a2fbad --- /dev/null +++ b/testcases/ebs-test/data/json/build_single-no-ground-projects.json @@ -0,0 +1,14 @@ +{ + "build_targets": [ + { + "os_variant": "openEuler:22.09", + "architecture": "aarch64", + "flag": { + "build": true, + "publish": true + } + } + ], + "snapshot_id": "", + "build_id": "" +} diff --git a/testcases/ebs-test/data/json/build_single-no-os-variant.json b/testcases/ebs-test/data/json/build_single-no-os-variant.json new file mode 100644 index 000000000..79ae72071 --- /dev/null +++ b/testcases/ebs-test/data/json/build_single-no-os-variant.json @@ -0,0 +1,14 @@ +{ + "build_targets": [ + { + "architecture": "aarch64", + "ground_projects": ["openEuler:22.09-BaseOS-0913-2230"], + "flag": { + "build": true, + "publish": true + } + } + ], + "snapshot_id": "", + "build_id": "" +} diff --git a/testcases/ebs-test/data/json/build_single-no-snapshot-id.json b/testcases/ebs-test/data/json/build_single-no-snapshot-id.json new file mode 100644 index 000000000..4f3745db9 --- /dev/null +++ b/testcases/ebs-test/data/json/build_single-no-snapshot-id.json @@ -0,0 +1,14 @@ +{ + "build_targets": [ + { + "os_variant": "openEuler:22.09", + "architecture": "aarch64", + "ground_projects": ["openEuler:22.09-BaseOS-0913-2230"], + "flag": { + "build": true, + "publish": true + } + } + ], + "build_id": "" +} diff --git a/testcases/ebs-test/data/json/build_targets.json b/testcases/ebs-test/data/json/build_targets.json new file mode 100644 index 000000000..d6b009797 --- /dev/null +++ b/testcases/ebs-test/data/json/build_targets.json @@ -0,0 +1,13 @@ +{ + "build_targets": [ + { + "os_variant": "openEuler:22.09", + "architecture": "aarch64", + "ground_projects": ["openEuler:22.09-BaseOS-0913-2230"], + "flag": { + "build": true, + "publish": true + } + } + ] +} diff --git a/testcases/ebs-test/data/json/build_targets_error.json b/testcases/ebs-test/data/json/build_targets_error.json new file mode 100644 index 000000000..dd7d27241 --- /dev/null +++ b/testcases/ebs-test/data/json/build_targets_error.json @@ -0,0 +1,15 @@ +{ + "build_targets": { + { + "os_variant": "openEuler:22.03-LTS", + "flag": { + "build": true, + "publish": true + }, + "ground_projects": [ + + ], + "architecture": "aarch64" + } + } +} diff --git a/testcases/ebs-test/data/json/build_targets_include.json b/testcases/ebs-test/data/json/build_targets_include.json new file mode 100644 index 000000000..c033c96ca --- /dev/null +++ b/testcases/ebs-test/data/json/build_targets_include.json @@ -0,0 +1,15 @@ +{ + "build_targets": [ + { + "os_variant": "openEuler:22.03-LTS-SP2", + "flags": { + "build": true, + "publish": true + }, + "ground_projects": [ + + ], + "architecture": "aarch64" + } + ] +} diff --git a/testcases/ebs-test/data/json/build_targets_include_snapshot.json b/testcases/ebs-test/data/json/build_targets_include_snapshot.json new file mode 100644 index 000000000..d6b009797 --- /dev/null +++ b/testcases/ebs-test/data/json/build_targets_include_snapshot.json @@ -0,0 +1,13 @@ +{ + "build_targets": [ + { + "os_variant": "openEuler:22.09", + "architecture": "aarch64", + "ground_projects": ["openEuler:22.09-BaseOS-0913-2230"], + "flag": { + "build": true, + "publish": true + } + } + ] +} diff --git a/testcases/ebs-test/data/json/build_targets_snapshot.json b/testcases/ebs-test/data/json/build_targets_snapshot.json new file mode 100644 index 000000000..710ee0a2d --- /dev/null +++ b/testcases/ebs-test/data/json/build_targets_snapshot.json @@ -0,0 +1,15 @@ +{ + "build_targets": [ + { + "os_variant": "openEuler:22.03-LTS-SP1", + "flags": { + "build": true, + "publish": true + }, + "ground_projects": [ + + ], + "architecture": "x86_64" + } + ] +} diff --git a/testcases/ebs-test/data/json/build_targets_snapshot_noinclude.json b/testcases/ebs-test/data/json/build_targets_snapshot_noinclude.json new file mode 100644 index 000000000..590e736d9 --- /dev/null +++ b/testcases/ebs-test/data/json/build_targets_snapshot_noinclude.json @@ -0,0 +1,15 @@ +{ + "build_targets": [ + { + "os_variant": "openEuler:22.03-LTS", + "architecture": "x86_64", + "ground_projects": [ + + ], + "flags": { + "build": true, + "publish": true + } + } + ] +} diff --git a/testcases/ebs-test/data/json/del.json b/testcases/ebs-test/data/json/del.json new file mode 100644 index 000000000..e9c628628 --- /dev/null +++ b/testcases/ebs-test/data/json/del.json @@ -0,0 +1,3 @@ +{ + "to_delete": true +} diff --git a/testcases/ebs-test/data/json/project-all-params.json b/testcases/ebs-test/data/json/project-all-params.json new file mode 100644 index 000000000..fa1fcd873 --- /dev/null +++ b/testcases/ebs-test/data/json/project-all-params.json @@ -0,0 +1,67 @@ + { + "lock": false, + "to_delete": false, + "users": { + "admin": "maintainer" + }, + "emsx": "ems1", + "spec_branch": "master", + "build_targets": [ + { + "os_variant": "openEuler:22.03-LTS-SP2", + "architecture": "aarch64", + "ground_projects": [ + + ], + "flags": { + "build": true, + "publish": true + } + }, + { + "os_variant": "openEuler:22.03-LTS-SP1", + "architecture": "x86_64", + "ground_projects": [ + + ], + "flags": { + "build": true, + "publish": true + } + } + ], + "bootstrap_rpm_repo": [ + { + "name": "everything", + "repo": "http://172.16.1.236:31744/dailybuild/EBS-openEuler-22.03-LTS-SP2/rc6_openeuler-2023-06-29-20-25-36/everything/" + } + ], + "my_specs": [ + { + "spec_name": "python-flask", + "spec_url": "https://gitee.com/src-openeuler/python-flask.git", + "spec_branch": "", + "spec_description": "" + }, + { + "spec_name": "bc", + "spec_url": "https://gitee.com/src-openeuler/bc.git", + "spec_branch": "", + "spec_description": "" + }, + { + "spec_name": "pcs", + "spec_url": "https://gitee.com/src-openeuler/pcs.git", + "spec_branch": "", + "spec_description": "" + } + ], + "package_overrides": { + "ceph": { + "to_delete": true + } + }, + "build_env_macros": "", + "description": "" +} + diff --git a/testcases/ebs-test/data/yaml/build_single-all-params.yaml b/testcases/ebs-test/data/yaml/build_single-all-params.yaml new file mode 100644 index 000000000..015b3f929 --- /dev/null +++ b/testcases/ebs-test/data/yaml/build_single-all-params.yaml @@ -0,0 +1,6 @@ +build_targets: + - os_variant: openEuler:22.03-LTS + architecture: aarch64 + flags: + build: true + publish: true diff --git a/testcases/ebs-test/data/yaml/build_single-no-architecture.yaml b/testcases/ebs-test/data/yaml/build_single-no-architecture.yaml new file mode 100644 index 000000000..39c4fdbc9 --- /dev/null +++ b/testcases/ebs-test/data/yaml/build_single-no-architecture.yaml @@ -0,0 +1,9 @@ +build_targets: +- os_variant: openEuler:22.09 + ground_projects: + - openEuler:22.09-BaseOS-0913-2230 + flag: + build: true + publish: true +snapshot_id: '' +build_id: '' diff --git a/testcases/ebs-test/data/yaml/build_single-no-build-id.yaml b/testcases/ebs-test/data/yaml/build_single-no-build-id.yaml new file mode 100644 index 000000000..7d26208ed --- /dev/null +++ b/testcases/ebs-test/data/yaml/build_single-no-build-id.yaml @@ -0,0 +1,9 @@ +build_targets: +- os_variant: openEuler:22.09 + architecture: aarch64 + ground_projects: + - openEuler:22.09-BaseOS-0913-2230 + flag: + build: true + publish: true +snapshot_id: '' diff --git a/testcases/ebs-test/data/yaml/build_single-no-ground-projects.yaml b/testcases/ebs-test/data/yaml/build_single-no-ground-projects.yaml new file mode 100644 index 000000000..8e102575f --- /dev/null +++ b/testcases/ebs-test/data/yaml/build_single-no-ground-projects.yaml @@ -0,0 +1,8 @@ +build_targets: +- os_variant: openEuler:22.09 + architecture: aarch64 + flag: + build: true + publish: true +snapshot_id: '' +build_id: '' diff --git a/testcases/ebs-test/data/yaml/build_single-no-os-variant.yaml b/testcases/ebs-test/data/yaml/build_single-no-os-variant.yaml new file mode 100644 index 000000000..cc7457c34 --- /dev/null +++ b/testcases/ebs-test/data/yaml/build_single-no-os-variant.yaml @@ -0,0 +1,9 @@ +build_targets: +- architecture: aarch64 + ground_projects: + - openEuler:22.09-BaseOS-0913-2230 + flag: + build: true + publish: true +snapshot_id: '' +build_id: '' diff --git a/testcases/ebs-test/data/yaml/build_single-no-snapshot-id.yaml b/testcases/ebs-test/data/yaml/build_single-no-snapshot-id.yaml new file mode 100644 index 000000000..fac443416 --- /dev/null +++ b/testcases/ebs-test/data/yaml/build_single-no-snapshot-id.yaml @@ -0,0 +1,9 @@ +build_targets: +- os_variant: openEuler:22.09 + architecture: aarch64 + ground_projects: + - openEuler:22.09-BaseOS-0913-2230 + flag: + build: true + publish: true +build_id: '' diff --git a/testcases/ebs-test/data/yaml/build_targets.yaml b/testcases/ebs-test/data/yaml/build_targets.yaml new file mode 100644 index 000000000..2fa7434bf --- /dev/null +++ b/testcases/ebs-test/data/yaml/build_targets.yaml @@ -0,0 +1,3 @@ +build_targets: +- os_variant: openEuler:20.03-LTS-SP1 + architecture: aarch64 diff --git a/testcases/ebs-test/data/yaml/snapshot-all-params.yaml b/testcases/ebs-test/data/yaml/snapshot-all-params.yaml new file mode 100644 index 000000000..273641c98 --- /dev/null +++ b/testcases/ebs-test/data/yaml/snapshot-all-params.yaml @@ -0,0 +1,2 @@ +prev_snapshot_id: "" +is_trunk: true diff --git a/testcases/ebs-test/data/yaml/snapshot-no-is-trunk.yaml b/testcases/ebs-test/data/yaml/snapshot-no-is-trunk.yaml new file mode 100644 index 000000000..eae0f04cc --- /dev/null +++ b/testcases/ebs-test/data/yaml/snapshot-no-is-trunk.yaml @@ -0,0 +1 @@ +prev_snapshot_id: ${snapshot_id} diff --git a/testcases/ebs-test/data/yaml/snapshot-no-prev-snapshot.yaml b/testcases/ebs-test/data/yaml/snapshot-no-prev-snapshot.yaml new file mode 100644 index 000000000..9914bbfde --- /dev/null +++ b/testcases/ebs-test/data/yaml/snapshot-no-prev-snapshot.yaml @@ -0,0 +1 @@ +is_trunk: true diff --git a/testcases/ebs-test/oe_test_ebs_build_single/oe_test_ebs_build_single_01.sh b/testcases/ebs-test/oe_test_ebs_build_single/oe_test_ebs_build_single_01.sh new file mode 100755 index 000000000..d717673ed --- /dev/null +++ b/testcases/ebs-test/oe_test_ebs_build_single/oe_test_ebs_build_single_01.sh @@ -0,0 +1,74 @@ +#!/usr/bin/bash + +# Copyright (c) 2023. huawei Technologies Co.,Ltd.ALL rights reserved. +# This program is licensed under Mulan PSL v2. +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ############################################# +# @Author : BaiJing +# @Contact : 799286817@qq.com +# @Date : 2023/02/20 +# @License : Mulan PSL v2 +# @Desc : Test build single +# ############################################# + +source "$OET_PATH/libs/locallibs/common_lib.sh" + +function pre_test() { + LOG_INFO "Start to prepare the test environment." + num=$(date +%M%S) + ccb create projects test-00${num} --json ../data/json/project-all-params.json | grep '\"code\": 0' + LOG_INFO "End to prepare the test environment." +} + +function run_test() { + LOG_INFO "Start to run test." + ccb build-single os_project=test-00${num} | grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check build single lack of packages parameter" + ccb build-single packages=python-flask | grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check build single lack of os_project parameter" + ccb build-single os_project=test-00${num} packages=python-flask | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "build single failed no build_id" + ccb build-single os_project=test-00${num} packages=python-flask --json ../data/json/build_single-all-params.json| grep '\"code\": 0' + CHECK_RESULT $? 0 0 "build single failed no build_id" + ccb build-single os_project=test-00${num} packages=python-flask --json ../data/json/build_targets_include.json | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "build single failed build_targets not included in project" + ccb build-single os_project=test-00${num} packages=python-flask --json ../data/json/build_targets_error.json| grep '\"code\": 0' + CHECK_RESULT $? 1 0 "build single failed build_targets not included in project" + ccb build-single os_project={xx} packages=python-flask | grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check build sinlge os_project parameter error " + ccb build-single os_project=xx packages=python-flask | grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check build sinlge os_project no exist" + build_id=$(ccb select builds os_project=test-00${num} -f build_id | tail -10 | grep build_id | awk -F ":" '{print $2}' | sed -e 's/^[ ]*//g' | sed 's/"\(.*\)"/\1/g') + ccb build-single os_project=test-00${num} packages=python-flask build_id=xx | grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check build single lack of build_id no exist" + snapshot_id=$(ccb select builds os_project=test-00${num} build_id=${build_id} -f snapshot_id | grep snapshot_id | awk -F ":" '{print $2}' | sed -e 's/^[ ]*//g' | sed 's/"\(.*\)"/\1/g') + ccb build-single os_project=test-00${num} packages=python-flask snapshot_id=${snapshot_id} | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check build single failed only snapshot_id" + ccb build-single os_project=test-00${num} packages=python-flask snapshot_id=${snapshot_id} --json ../data/json/build_targets_snapshot_noinclude.json| grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check build single failed build targets not include in snapshot" + ccb build-single os_project=test-00${num} packages=python-flask snapshot_id=${snapshot_id} --json ../data/json/build_targets_snapshot.json| grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check build single failed build targets include in snapshot" + ccb build-single os_project=test-00${num} packages=python-flask --json ../data/json/build_targets_snapshot.json --yaml ../data/yaml/build_single-all-params.yaml build_id=1234 | grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check build single failed build id no exist" + ccb build-single os_project=test-00${num} packages=python-flask --json ../data/json/build_targets_snapshot.json --yaml ../data/yaml/build_single-all-params.yaml | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check build single failed json error" + ccb build-single os_project=test-00${num} packages=python-flask --json ../data/json/build_targets_snapshot.json build_id=1234 --yaml ../data/yaml/build_single-all-params.yaml | grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check build single failed build id no exist" + ccb build-single os_project=test-00${num} packages=python-flask build_id=${build_id} snapshot_id=xx | grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check build single failed snapshot_id no exist" + LOG_INFO "End to run test." +} + +function post_test() { + LOG_INFO "Start to restore the test environment." + ccb update projects test-00${num} -j ../data/json/del.json + LOG_INFO "End to restore the test environment." +} + +main "$@" diff --git a/testcases/ebs-test/oe_test_ebs_create_snapshot/oe_test_ebs_create_snapshot_01.sh b/testcases/ebs-test/oe_test_ebs_create_snapshot/oe_test_ebs_create_snapshot_01.sh new file mode 100755 index 000000000..6ded71d48 --- /dev/null +++ b/testcases/ebs-test/oe_test_ebs_create_snapshot/oe_test_ebs_create_snapshot_01.sh @@ -0,0 +1,74 @@ +#!/usr/bin/bash + +# Copyright (c) 2023. huawei Technologies Co.,Ltd.ALL rights reserved. +# This program is licensed -i under Mulan PSL v2. +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ############################################# +# @Author : BaiJing +# @Contact : 799286817@qq.com +# @Date : 2023/02/20 +# @License : Mulan PSL v2 +# @Desc : Test create snapshot +# ############################################# + +source "$OET_PATH/libs/locallibs/common_lib.sh" + +function pre_test() { + LOG_INFO "Start to prepare the test environment." + num=$(date +%M%S) + ccb create projects test-00${num} --json ../data/json/project-all-params.json | grep '\"code\": 0' + LOG_INFO "End to prepare the test environment." +} + +function run_test() { + LOG_INFO "Start to run test." + ccb create snapshots test-00${num}| grep '\"code\": 0' + CHECK_RESULT $? 0 0 "create snapshot fail" + ccb create snapshots | grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check create snapshot error no project" + snapshot_id=$(ccb select snapshots os_project=test-00${num} -f snapshot_id | tail -10 | grep snapshot_id | awk -F ":" '{print $2}' | sed -e 's/^[ ]*//g' | sed 's/"\(.*\)"/\1/g') + ccb create snapshots test-00${num} prev_snapshot_id=${snapshot_id} | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check create snapshot error" + ccb create snapshots xxx prev_snapshot_id=${snapshot_id} | grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check create snapshot error" + ccb create snapshots [test-00${num}] prev_snapshot_id=${snapshot_id} | grep '\"code\": 0' + CHECK_RESULT $? 1 0 "Check create snapshot error" + sed -i 's/id\": .*/id\": "'${snapshot_id}'",/g' ../data/json/snapshot-all-params.json + ccb create snapshots test-00${num} --json ../data/json/snapshot-all-params.json | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check create snapshot error" + sed -i 's/id\": .*/id\": "'${snapshot_id}'"/g' ../data/json/snapshot-no-is-trunk.json + ccb create snapshots test-00${num} --json ../data/json/snapshot-no-is-trunk.json | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check create snapshot error" + ccb create snapshots test-00${num} --json ../data/json/snapshot-no-prev-snapshot.json | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check create snapshot error" + sed -i 's/: .*/: ${snapshot_id}/g' ../data/yaml/snapshot-no-is-trunk.yaml + ccb create snapshots test-00${num} --yaml ../data/yaml/snapshot-no-is-trunk.yaml | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check create snapshot error" + ccb create snapshots test-00${num} --yaml ../data/yaml/snapshot-no-prev-snapshot.yaml | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check create snapshot error" + ccb create snapshots test-00${num} --yaml ../data/yaml/snapshot-all-params.yaml | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check create snapshot error" + ccb create snapshots test-00${num} --yaml ../data/yaml/snapshot-no-is-trunk.yaml prev_snapshot_id=${snapshot_id} | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check create snapshot error" + ccb create snapshots test-00${num} --json ../data/json/snapshot-all-params.json --yaml ../data/yaml/snapshot-no-is-trunk.yaml prev_snapshot_id=${snapshot_id}| grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check create snapshot error" + ccb create snapshots test-00${num} --yaml ../data/yaml/snapshot-all-params.yaml --json ../data/json/snapshot-no-is-trunk.json prev_snapshot_id=${snapshot_id}| grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check create snapshot error" + ccb create snapshots test-00${num} prev_snapshot_id=${snapshot_id} --yaml ../data/yaml/snapshot-all-params.yaml --json ../data/json/snapshot-no-is-trunk.json | grep '\"code\": 0' + CHECK_RESULT $? 0 0 "Check create snapshot error" + LOG_INFO "End to run test." +} + +function post_test() { + LOG_INFO "Start to restore the test environment." + ccb update projects test-00${num} -j ../data/json/del.json + LOG_INFO "End to restore the test environment." +} + +main "$@" -- Gitee From cf4e0f784920626da8d6c9598fd43f2c975d42ab Mon Sep 17 00:00:00 2001 From: baijing <799286817@qq.com> Date: Fri, 1 Sep 2023 09:24:28 +0800 Subject: [PATCH 2/4] update eulermaker date --- .../oe_test_ebs_build_single/oe_test_ebs_build_single_01.sh | 2 +- .../oe_test_ebs_create_snapshot_01.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/ebs-test/oe_test_ebs_build_single/oe_test_ebs_build_single_01.sh b/testcases/ebs-test/oe_test_ebs_build_single/oe_test_ebs_build_single_01.sh index d717673ed..654483564 100755 --- a/testcases/ebs-test/oe_test_ebs_build_single/oe_test_ebs_build_single_01.sh +++ b/testcases/ebs-test/oe_test_ebs_build_single/oe_test_ebs_build_single_01.sh @@ -12,7 +12,7 @@ # ############################################# # @Author : BaiJing # @Contact : 799286817@qq.com -# @Date : 2023/02/20 +# @Date : 2023/09/01 # @License : Mulan PSL v2 # @Desc : Test build single # ############################################# diff --git a/testcases/ebs-test/oe_test_ebs_create_snapshot/oe_test_ebs_create_snapshot_01.sh b/testcases/ebs-test/oe_test_ebs_create_snapshot/oe_test_ebs_create_snapshot_01.sh index 6ded71d48..48a92b781 100755 --- a/testcases/ebs-test/oe_test_ebs_create_snapshot/oe_test_ebs_create_snapshot_01.sh +++ b/testcases/ebs-test/oe_test_ebs_create_snapshot/oe_test_ebs_create_snapshot_01.sh @@ -12,7 +12,7 @@ # ############################################# # @Author : BaiJing # @Contact : 799286817@qq.com -# @Date : 2023/02/20 +# @Date : 2023/09/01 # @License : Mulan PSL v2 # @Desc : Test create snapshot # ############################################# -- Gitee From 6491eef1a386125983cf0c2ac13c7a973c7f17cf Mon Sep 17 00:00:00 2001 From: baijing_0022 <799286817@qq.com> Date: Fri, 1 Sep 2023 02:02:18 +0000 Subject: [PATCH 3/4] update testcases/ebs-test/data/json/project-all-params.json. Signed-off-by: baijing_0022 <799286817@qq.com> --- testcases/ebs-test/data/json/project-all-params.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/ebs-test/data/json/project-all-params.json b/testcases/ebs-test/data/json/project-all-params.json index fa1fcd873..534651197 100644 --- a/testcases/ebs-test/data/json/project-all-params.json +++ b/testcases/ebs-test/data/json/project-all-params.json @@ -33,7 +33,7 @@ "bootstrap_rpm_repo": [ { "name": "everything", - "repo": "http://172.16.1.236:31744/dailybuild/EBS-openEuler-22.03-LTS-SP2/rc6_openeuler-2023-06-29-20-25-36/everything/" + "repo": "https://repo.huaweicloud.com/openeuler/openEuler-22.03-LTS/everything/" } ], "my_specs": [ -- Gitee From 04b57af8c5445ce5b11849b7a902bf83dc83eb3f Mon Sep 17 00:00:00 2001 From: baijing <799286817@qq.com> Date: Fri, 1 Sep 2023 10:09:49 +0800 Subject: [PATCH 4/4] add suitecase --- suite2cases/ebs_build_single.json | 8 ++++++++ suite2cases/ebs_create_snapshot.json | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 suite2cases/ebs_build_single.json create mode 100644 suite2cases/ebs_create_snapshot.json diff --git a/suite2cases/ebs_build_single.json b/suite2cases/ebs_build_single.json new file mode 100644 index 000000000..3eb2dd0e1 --- /dev/null +++ b/suite2cases/ebs_build_single.json @@ -0,0 +1,8 @@ +{ + "path": "$OET_PATH/testcases/ebs-test/oe_test_ebs_build_single", + "cases": [ + { + "name": "oe_test_ebs_build_single_01" + } + ] +} diff --git a/suite2cases/ebs_create_snapshot.json b/suite2cases/ebs_create_snapshot.json new file mode 100644 index 000000000..8739d1cbb --- /dev/null +++ b/suite2cases/ebs_create_snapshot.json @@ -0,0 +1,8 @@ +{ + "path": "$OET_PATH/testcases/ebs-test/oe_test_ebs_create_snapshot", + "cases": [ + { + "name": "oe_test_ebs_create_snapshot_01" + } + ] +} -- Gitee