提交 c3d1bed6 编写于 作者: Classiriver_jia's avatar Classiriver_jia

docker_and_isulad

上级 2b59e1b3
......@@ -35,3 +35,26 @@ oe_test_syslog_journalctl_002
oe_test_syslog_journald_001
oe_test_syslog_logrotate_001
oe_test_syslog_messages_001
oe_test_docker_attach_001
oe_test_docker_commit_export_import_001
oe_test_docker_cp_001
oe_test_docker_create_001
oe_test_docker_create_002
oe_test_docker_create_003
oe_test_docker_exec_cmd_001
oe_test_docker_image_history_001
oe_test_docker_rename_pause_resume_001
oe_test_docker_save_load_001
oe_test_docker_search_info_001
oe_test_docker_start_stop_delete_001
oe_test_docker_tag_001
oe_test_iSula_attach_rename_001
oe_test_iSula_cp_001
oe_test_iSula_create_start_001
oe_test_iSula_exec_cmd_001
oe_test_iSula_export_001
oe_test_iSula_install_deploy_001
oe_test_iSula_pause_resume_001
oe_test_iSula_query_state_001
oe_test_iSula_restart_stop_001
oe_test_iSula_search_info_001
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : prepare_docker
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : prepare docker
# ############################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
Images_name="busybox"
Image_address="ariq8blp.mirror.aliyuncs.com"
function pre_docker_env() {
DNF_INSTALL docker
ping ${Image_address} -c 3
if [ $? -ne 0 ];then
clean_docker_env
if [ ${FRAME} == aarch64 ];then
docker load -i ../common/openEuler-docker.aarch64.tar.xz
else
docker load -i ../common/openEuler-docker.x86_64.tar.xz
fi
Images_name=$(docker images | grep latest | awk '{print$1}')
else
docker pull ${Images_name}
fi
}
function run_docker_container() {
containers_id=$(docker run -itd ${Images_name})
CHECK_RESULT $?
docker inspect -f {{.State.Status}} ${containers_id} | grep running
CHECK_RESULT $?
}
function clean_docker_env() {
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker images -q)
test -z "$(docker images -q)"
CHECK_RESULT $?
}
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : prepare_isulad
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : prepare isulad
# ############################################
source ${OET_PATH}/libs/locallibs/common_lib.sh
Images_names="busybox"
Image_address="ariq8blp.mirror.aliyuncs.com"
function pre_isulad_env() {
DNF_INSTALL "iSulad tar"
clean_isulad_env
ping ${Image_address} -c 3
if [ $? -eq 0 ];then
sed -i "/registry-mirrors/a\"https:\/\/${Image_address}\"" /etc/isulad/daemon.json
systemctl restart isulad
isula pull ${Images_name}
else
if [ ${FRAME} == aarch64 ];then
isula load -i ../common/openEuler-docker.aarch64.tar.xz
else
isula load -i ../common/openEuler-docker.x86_64.tar.xz
fi
Images_name=$(isula images | grep latest | awk '{print$1}')
fi
}
function run_isulad_container() {
containerId=$(isula run -itd ${Images_name})
CHECK_RESULT $?
isula inspect -f {{.State.Status}} ${containerId} | grep running
CHECK_RESULT $?
}
function clean_isulad_env() {
isula stop $(isula ps -aq)
isula rm $(isula ps -aq)
isula rmi $(isula images -q)
test -z "$(isula images -q)"
CHECK_RESULT $?
sed -i "/${Image_address}/d" /etc/isulad/daemon.json
}
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_attach_001
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Access container
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
run_docker_container
expect -c "
log_file testlog
spawn docker attach ${containers_id}
expect {
\"*\/*\" {send \"exit\r\"}
}
expect eof
"
grep -iE 'error|fail' testlog
CHECK_RESULT $? 1
cat testlog | grep "/" | grep "exit"
CHECK_RESULT $?
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_docker_env
DNF_REMOVE docker
rm -rf testlog
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_commit_export_import_001
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Commit / export / import application of container
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
run_docker_container
docker commit ${containers_id} ${Images_name}:test
CHECK_RESULT $?
docker images | grep ${Images_name} | grep -w test
CHECK_RESULT $?
docker export ${containers_id} > ${Images_name}.tar
CHECK_RESULT $?
test -f ${Images_name}.tar
CHECK_RESULT $?
clean_docker_env
docker images | grep ${Images_name}
CHECK_RESULT $? 1
docker import ${Images_name}.tar ${Images_name}:latest
CHECK_RESULT $?
docker images | grep ${Images_name} | grep latest
CHECK_RESULT $?
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
docker rmi $(docker images -q)
DNF_REMOVE docker
rm -rf ${Images_name}.tar
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_cp_001
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : data copy between the container and the host
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
run_docker_container
test -d testdir && rm -rf testdir
mkdir testdir
touch testdir/mytest.txt
docker cp testdir ${containers_id}:/root
CHECK_RESULT $?
docker exec -i ${containers_id} /bin/sh >testlog <<EOF
ls /root/testdir
exit
EOF
grep "mytest.txt" testlog
CHECK_RESULT $?
test -d root && rm -rf root
docker cp ${containers_id}:/root .
CHECK_RESULT $?
ls root/testidr | grep mytest.txt
CHECK_RESULT $?
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_docker_env
DNF_REMOVE docker
rm -rf testdir root testlog
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_create_001
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Create container to run simple application
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
docker run ${Images_name} /bin/echo "Hello world" | grep "Hello world"
CHECK_RESULT $?
docker ps -l | grep ${Images_name} | grep Hello
CHECK_RESULT $?
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_docker_env
DNF_REMOVE docker
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_create_002
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Creating an interactive container
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
expect -c "
log_file testlog
spawn docker run -it ${Images_name} /bin/sh
expect {
\"*#*\" {send \"ls\r\"
expect \"*#*\" {send \"pwd\r\"}
expect \"*#*\" {send \"exit\r\"}
}
}
"
grep -iE 'error|fail' testlog
CHECK_RESULT $? 1
cat testlog | grep -E 'bin|dev'
CHECK_RESULT $?
cat testlog | grep pwd -A 1 | tail -1 | grep -w '/'
CHECK_RESULT $?
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_docker_env
DNF_REMOVE docker
rm -rf testlog
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_create_003
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Background run container (run in background after creation)
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
containers_id=$(docker run -d ${Images_name} /bin/sh -c "while true;do echo hello world;sleep 1;done")
CHECK_RESULT $?
docker inspect -f {{.State.Status}} ${containers_id} | grep running
CHECK_RESULT $?
docker logs ${containers_id} | grep "hello world"
CHECK_RESULT $?
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_docker_env
DNF_REMOVE docker
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_exec_cmd_001
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Execute new commands in the container
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
run_docker_container
docker exec -i ${containers_id} /bin/sh >testlog <<EOF
ls /
exit
EOF
grep -E 'bin|root' testlog
CHECK_RESULT $?
docker exec -i ${containers_id} /bin/sh >testlog <<EOF
ls / | grep bin
exit
EOF
cat testlog | grep -v grep | grep "bin"
CHECK_RESULT $?
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_docker_env
DNF_REMOVE docker
rm -rf testlog
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_image_history_001
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Display the change history of an image
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
images_id=$(docker images ${Images_name} -q)
docker history ${Images_name}:latest | grep ${images_id}
CHECK_RESULT $?
containers_id=$(docker run -itd ${Images_name})
docker export ${containers_id} > ${Images_name}.tar
CHECK_RESULT $?
test -f ${Images_name}.tar
CHECK_RESULT $?
clean_docker_env
docker import ${Images_name}.tar ${Images_name}:latest
CHECK_RESULT $?
docker images | grep ${Images_name} | grep latest
CHECK_RESULT $?
docker history ${Images_name}:latest | grep -i "Imported"
CHECK_RESULT $?
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
docker rmi $(docker images -q)
DNF_REMOVE docker
rm -rf ${Images_name}.tar
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_rename_pause_resume_001
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Rename container/pause and resume container process
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "Start loading data."
container_name=old_container
new_name=new_container
LOG_INFO "Loading data is complete."
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
docker run -itd --name=${container_name} ${Images_name}
CHECK_RESULT $?
docker rename ${container_name} ${new_name}
CHECK_RESULT $?
docker ps -a | grep ${new_name}
CHECK_RESULT $?
docker ps -a | grep ${container_name}
CHECK_RESULT $? 1
docker pause ${new_name}
CHECK_RESULT $?
docker inspect -f {{.State.Status}} ${new_name} | grep paused
docker unpause ${new_name}
CHECK_RESULT $?
docker inspect -f {{.State.Status}} ${new_name} | grep running
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_docker_env
DNF_REMOVE docker
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_save_load_001
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Save an image to a tar package / tar package saved by docker reload an image
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
docker images | grep ${Images_name}
CHECK_RESULT $?
docker save -o ${Images_name}.tar ${Images_name}:latest
CHECK_RESULT $?
test -f ${Images_name}.tar
CHECK_RESULT $?
Images_id=$(docker images ${Images_name} -q)
docker rmi ${Images_id}
docker images | grep ${Images_name}
CHECK_RESULT $? 1
docker load -i ${Images_name}.tar
CHECK_RESULT $?
docker images | grep ${Images_name}
CHECK_RESULT $?
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf ${Images_name}.tar
clean_docker_env
DNF_REMOVE docker
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_search_info_001
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Container information query
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "Start loading data."
container_name=container_test
LOG_INFO "Loading data is complete."
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
containers_id=$(docker run -itd --name=${container_name} ${Images_name})
CHECK_RESULT $?
docker inspect -f {{.State.Status}} ${container_name} | grep running
CHECK_RESULT $?
docker inspect -f {{.Name}} ${container_name} | grep ${container_name}
CHECK_RESULT $?
docker inspect -f {{.State.Status}} ${containers_id} | grep running
CHECK_RESULT $?
docker inspect -f {{.Name}} ${containers_id} | grep ${container_name}
CHECK_RESULT $?
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_docker_env
DNF_REMOVE docker
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_start_stop_delete_001
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Start / stop / delete container
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "Start loading data."
container_name=container_test
LOG_INFO "Loading data is complete."
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
docker run -itd --name=${container_name} ${Images_name}
CHECK_RESULT $?
docker inspect -f {{.State.Status}} ${container_name} | grep running
CHECK_RESULT $?
docker stop ${container_name}
CHECK_RESULT $?
docker inspect -f {{.State.Status}} ${container_name} | grep exited
CHECK_RESULT $?
docker start ${container_name}
CHECK_RESULT $?
docker inspect -f {{.State.Status}} ${container_name} | grep running
CHECK_RESULT $?
docker kill ${container_name}
CHECK_RESULT $?
docker inspect -f {{.State.Status}} ${container_name} | grep exited
CHECK_RESULT $?
docker rm ${container_name}
CHECK_RESULT $?
docker ps -a | grep ${container_name}
CHECK_RESULT $? 1
docker run -itd --name=${container_name} ${Images_name}
CHECK_RESULT $?
docker inspect -f {{.State.Status}} ${container_name} | grep running
CHECK_RESULT $?
docker stop ${container_name}
CHECK_RESULT $?
docker rm -f ${container_name}
CHECK_RESULT $?
docker ps -a | grep ${container_name}
CHECK_RESULT $? 1
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_docker_env
DNF_REMOVE docker
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_docker_tag_001
# @Author : Classicriver_jia
# @Contact : classicriver_jia@foxmail.com
# @Date : 2020-06-08
# @License : Mulan PSL v2
# @Desc : Tag an image into a library
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_docker.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_docker_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase."
docker images | grep ${Images_name}
CHECK_RESULT $?
docker tag ${Images_name}:latest ${Images_name}:test_tag
CHECK_RESULT $?
docker images | grep ${Images_name} | grep test_tag
CHECK_RESULT $?
LOG_INFO "End of testcase execution."
}
function post_test() {
LOG_INFO "start environment cleanup."
docker rmi ${Images_name}:test_tag
clean_docker_env
DNF_REMOVE docker
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_iSula_attach_rename_001
# @Author : duanxuemin
# @Contact : duanxuemin@163.com
# @Date : 2020-06-09
# @License : Mulan PSL v2
# @Desc : attach and rename containers
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_isulad.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_isulad_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase!"
run_isulad_container
expect -c "
log_file testlog
spawn isula attach ${containerId}
sleep 1
expect {
\"\" {send \"\r\";
expect \"*/*\" {send \"exit\r\"}
}
}
expect eof
"
grep -iE 'error|fail' testlog
CHECK_RESULT $? 1
cat testlog | grep "/" | grep "exit"
CHECK_RESULT $?
container_name=$(isula ps -a | grep ${Images_name} | awk '{print$NF}')
CHECK_RESULT $?
isula rename ${container_name} ${container_name}_test
CHECK_RESULT $?
isula ps -a | grep "${container_name}_test"
CHECK_RESULT $?
LOG_INFO "End of testcase execution!"
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_isulad_env
DNF_REMOVE "iSulad tar"
rm -rf testlog
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_iSula_cp_001
# @Author : duanxuemin
# @Contact : duanxuemin@163.com
# @Date : 2020-06-09
# @License : Mulan PSL v2
# @Desc : Copy between container and host
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_isulad.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_isulad_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase!"
run_isulad_container
test -d testdir || mkdir testdir
touch testdir/mytest.txt
isula cp testdir ${containerId}:/home
CHECK_RESULT $?
isula exec -it ${containerId} /bin/sh -c "ls /home/testdir" | grep mytest.txt
CHECK_RESULT $?
isula cp ${containerId}:/home .
CHECK_RESULT $?
ls home/testdir | grep mytest.txt
CHECK_RESULT $?
LOG_INFO "End of testcase execution!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf testdir home
clean_isulad_env
DNF_REMOVE "iSulad tar"
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_iSula_create_start_001
# @Author : duanxuemin
# @Contact : duanxuemin@163.com
# @Date : 2020-06-09
# @License : Mulan PSL v2
# @Desc : create and start container
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_isulad.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_isulad_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase!"
containerId=$(isula create -it ${Images_name})
CHECK_RESULT $?
isula start ${containerId}
CHECK_RESULT $?
isula inspect -f {{.State.Status}} ${containerId} | grep running
LOG_INFO "End of testcase execution!"
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_isulad_env
DNF_REMOVE "iSulad tar"
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_iSula_exec_cmd_001
# @Author : duanxuemin
# @Contact : duanxuemin@163.com
# @Date : 2020-06-09
# @License : Mulan PSL v2
# @Desc : Execute command in container
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_isulad.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_isulad_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase!"
run_isulad_container
expect -c "
log_file testlog
spawn isula attach ${containerId}
sleep 1
expect {
\"\" {send \"\r\";
expect \"\/*\" {send \"ls\r\"}
expect \"\/*\" {send \"exit\r\"}
}
}
"
cat testlog | grep -E 'bin|home'
CHECK_RESULT $?
isula start ${containerId}
isula inspect -f {{.State.Status}} ${containerId} | grep running
CHECK_RESULT $?
isula exec -it ${containerId} /bin/sh -c "ls / | grep bin" | grep bin
CHECK_RESULT $?
LOG_INFO "End of testcase execution!"
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_isulad_env
DNF_REMOVE "iSulad tar"
rm -rf testlog
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_iSula_export_001
# @Author : duanxuemin
# @Contact : duanxuemin@163.com
# @Date : 2020-06-09
# @License : Mulan PSL v2
# @Desc : Export container
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_isulad.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_isulad_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase!"
isula run -itd ${Images_name}
CHECK_RESULT $?
container_name=$(isula ps -a | grep ${Images_name} | awk '{print$NF}')
CHECK_RESULT $?
isula inspect -f {{.State.Status}} ${container_name} | grep running
CHECK_RESULT $?
isula export -o ${Images_name}.tar ${container_name}
CHECK_RESULT $?
test -f ${Images_name}.tar
CHECK_RESULT $?
LOG_INFO "End of testcase execution!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf ${Images_name}.tar
clean_isulad_env
DNF_REMOVE "iSulad tar"
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_iSula_install_deploy_001
# @Author : duanxuemin
# @Contact : duanxuemin@163.com
# @Date : 2020-06-09
# @License : Mulan PSL v2
# @Desc : install and deploy iSula container
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_isulad.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
DNF_INSTALL iSulad
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase!"
systemctl status isulad | grep running
CHECK_RESULT $?
sed -i "/registry-mirrors/a\"https:\/\/${Image_address}\"" /etc/isulad/daemon.json
systemctl restart isulad
CHECK_RESULT $?
systemctl status isulad | grep running
CHECK_RESULT $?
LOG_INFO "End of testcase execution!"
}
function post_test() {
LOG_INFO "start environment cleanup."
rm -rf /etc/isulad/daemon.json
sed -i "/${Image_address}/d" /etc/isulad/daemon.json
DNF_REMOVE iSulad
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
#copyright (c) [2020] 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.
# #############################################
# @Casename : oe_test_iSula_pause_resume_001
# @Author : duanxuemin
# @Contact : duanxuemin@163.com
# @Date : 2020-06-09
# @License : Mulan PSL v2
# @Desc : Pause and resume container / query isula information
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_isulad.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_isulad_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase!"
isula run -itd ${Images_name}
CHECK_RESULT $?
container_name=$(isula ps -a | grep ${Images_name} | awk '{print$NF}')
isula inspect -f {{.State.Status}} ${container_name} | grep running
CHECK_RESULT $?
isula pause ${container_name}
CHECK_RESULT $?
isula inspect -f {{.State.Status}} ${container_name} | grep paused
CHECK_RESULT $?
isula unpause ${container_name}
CHECK_RESULT $?
isula inspect -f {{.State.Status}} ${container_name} | grep running
CHECK_RESULT $?
isula version | grep -i version
CHECK_RESULT $?
isula info | grep "/var/lib/isula"
CHECK_RESULT $?
LOG_INFO "End of testcase execution!"
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_isulad_env
DNF_REMOVE "iSulad tar"
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_iSula_query_state_001
# @Author : duanxuemin
# @Contact : duanxuemin@163.com
# @Date : 2020-06-09
# @License : Mulan PSL v2
# @Desc : Querying resources used by containers
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_isulad.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_isulad_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase!"
containerId=$(isula run -itd ${Images_name} /bin/sh -c "while true;do echo hello world;sleep 1;done")
CHECK_RESULT $?
isula inspect -f {{.State.Status}} ${containerId} | grep running
CHECK_RESULT $?
isula logs ${containerId} | grep "hello world"
CHECK_RESULT $?
isula top ${containerId}
CHECK_RESULT $?
LOG_INFO "End of testcase execution!"
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_isulad_env
DNF_REMOVE "iSulad tar"
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_iSula_restart_stop_001
# @Author : duanxuemin
# @Contact : duanxuemin@163.com
# @Date : 2020-06-09
# @License : Mulan PSL v2
# @Desc : restart and stop container
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_isulad.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_isulad_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase!"
run_isulad_container
isula restart ${containerId} | grep ${containerId}
CHECK_RESULT $?
isula inspect -f {{.State.Status}} ${containerId} | grep running
CHECK_RESULT $?
isula stop ${containerId} | grep ${containerId}
CHECK_RESULT $?
isula inspect -f {{.State.Status}} ${containerId} | grep exited
CHECK_RESULT $?
isula start ${containerId}
CHECK_RESULT $?
isula inspect -f {{.State.Status}} ${containerId} | grep running
CHECK_RESULT $?
isula kill ${containerId} | grep ${containerId}
CHECK_RESULT $?
isula inspect -f {{.State.Status}} ${containerId} | grep exited
CHECK_RESULT $?
LOG_INFO "End of run testcase!"
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_isulad_env
DNF_REMOVE "iSulad tar"
LOG_INFO "Finish environment cleanup."
}
main $@
#!/usr/bin/bash
# Copyright (c) 2020 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.
# #############################################
# @CaseName : oe_test_iSula_search_info_001
# @Author : duanxuemin
# @Contact : duanxuemin@163.com
# @Date : 2020-06-09
# @License : Mulan PSL v2
# @Desc : search container information
# ############################################
source ${OET_PATH}/testcases/smoke-testing/common/prepare_isulad.sh
source ${OET_PATH}/libs/locallibs/common_lib.sh
function config_params() {
LOG_INFO "This test case has no config params to load!"
}
function pre_test() {
LOG_INFO "Start environment preparation."
pre_isulad_env
LOG_INFO "Environmental preparation is over."
}
function run_test() {
LOG_INFO "Start executing testcase!"
run_isulad_container
isula ps -a | grep ${Images_name}
CHECK_RESULT $?
container_name=$(isula ps -a | grep ${Images_name} | awk '{print$NF}')
CHECK_RESULT $?
isula inspect -f {{.State.Status}} ${container_name} | grep running
CHECK_RESULT $?
LOG_INFO "End of testcase execution!"
}
function post_test() {
LOG_INFO "start environment cleanup."
clean_isulad_env
DNF_REMOVE "iSulad tar"
LOG_INFO "Finish environment cleanup."
}
main $@
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册