diff --git a/suite2cases/ebs_build_single.json b/suite2cases/ebs_build_single.json new file mode 100644 index 0000000000000000000000000000000000000000..3eb2dd0e15d2ed63b40224f4042a36d987fd7c72 --- /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 0000000000000000000000000000000000000000..8739d1cbb2c7030d8cb3d1ea5d7df09b211cc45f --- /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" + } + ] +} 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 0000000000000000000000000000000000000000..f2b7483e6161c9429ac8d1f60aec241a66dc066a --- /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 0000000000000000000000000000000000000000..9fcc52ec596857001ab97833ff89081a19c2417e --- /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 0000000000000000000000000000000000000000..e63e5626f223fda0eb39838a0cc23a5768a8c71e --- /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 0000000000000000000000000000000000000000..fd9a2fbadf0f544d210be75cff43d765dc4a2a19 --- /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 0000000000000000000000000000000000000000..79ae72071c6942a0e127e04faf3aac27dbcad6d4 --- /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 0000000000000000000000000000000000000000..4f3745db981f114c3a8364da74f85bbe53e8a70a --- /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 0000000000000000000000000000000000000000..d6b0097975247a7c11763290e165167f8725400e --- /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 0000000000000000000000000000000000000000..dd7d272411a55ad55358ffce1ce1504c366ca5af --- /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 0000000000000000000000000000000000000000..c033c96caed273d333208d8938ce71faf4502df2 --- /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 0000000000000000000000000000000000000000..d6b0097975247a7c11763290e165167f8725400e --- /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 0000000000000000000000000000000000000000..710ee0a2d1f97c751b3c7b35d258a66959cd63ab --- /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 0000000000000000000000000000000000000000..590e736d92bad239009cd6a6c347e9904ed2165c --- /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 0000000000000000000000000000000000000000..e9c6286287260c9f27824bd0b56896ac01a89b77 --- /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 0000000000000000000000000000000000000000..534651197baaabd1fea9b4d74892f67d56324bcc --- /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": "https://repo.huaweicloud.com/openeuler/openEuler-22.03-LTS/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 0000000000000000000000000000000000000000..015b3f9295d9503a52910b95001d2c7960394cfc --- /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 0000000000000000000000000000000000000000..39c4fdbc9d2308d62a8630ee1b135b8d5b896b7d --- /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 0000000000000000000000000000000000000000..7d26208edd6c31f2a8cbcbedf8207df30423b992 --- /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 0000000000000000000000000000000000000000..8e102575f1015eb8749f0d8f7985c6607da099be --- /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 0000000000000000000000000000000000000000..cc7457c34de6cb9abd2d2e402feb88c2d1aeea0e --- /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 0000000000000000000000000000000000000000..fac443416e918bf267a4d2cf13d1ca1915b2da8c --- /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 0000000000000000000000000000000000000000..2fa7434bf6b0940607e701f391c6fa8cbf7e4ed5 --- /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 0000000000000000000000000000000000000000..273641c98b75480a301ffec179dda0b7559f3a4e --- /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 0000000000000000000000000000000000000000..eae0f04ccacefbf2393cc2714ebe2e79bac0aef7 --- /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 0000000000000000000000000000000000000000..9914bbfde7677f19896f33fe1f37380f6cec9327 --- /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 0000000000000000000000000000000000000000..65448356461a71a0d8585533d5bf2ab7d532f29d --- /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/09/01 +# @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 0000000000000000000000000000000000000000..48a92b781aedf89e0f4e1f69257620fd9f9d2a26 --- /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/09/01 +# @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 "$@"