diff options
Diffstat (limited to '0193-add-dt-for-cri-v1.patch')
-rw-r--r-- | 0193-add-dt-for-cri-v1.patch | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/0193-add-dt-for-cri-v1.patch b/0193-add-dt-for-cri-v1.patch new file mode 100644 index 0000000..2c206f5 --- /dev/null +++ b/0193-add-dt-for-cri-v1.patch @@ -0,0 +1,209 @@ +From bb2ed9b37d7c69b0af88487693826556321d46e9 Mon Sep 17 00:00:00 2001 +From: zhongtao <zhongtao17@huawei.com> +Date: Tue, 11 Feb 2025 22:42:39 +0800 +Subject: [PATCH 193/198] add dt for cri v1 + +Signed-off-by: zhongtao <zhongtao17@huawei.com> +--- + CI/test_cases/container_cases/cri_stats.sh | 90 ++++++++++++++++++++++ + CI/test_cases/container_cases/cri_test.sh | 80 +++++++++++++++++++ + 2 files changed, 170 insertions(+) + create mode 100755 CI/test_cases/container_cases/cri_stats.sh + +diff --git a/CI/test_cases/container_cases/cri_stats.sh b/CI/test_cases/container_cases/cri_stats.sh +new file mode 100755 +index 00000000..f6acb397 +--- /dev/null ++++ b/CI/test_cases/container_cases/cri_stats.sh +@@ -0,0 +1,90 @@ ++#!/bin/bash ++# ++# attributes: isulad basic cri seccomp ++# concurrent: NA ++# spend time: 4 ++ ++####################################################################### ++##- Copyright (c) Huawei Technologies Co., Ltd. 2022. All rights reserved. ++# - iSulad licensed under the Mulan PSL v2. ++# - You can use this software according to the terms and conditions of the Mulan PSL v2. ++# - You may obtain a copy of Mulan PSL v2 at: ++# - http://license.coscl.org.cn/MulanPSL2 ++# - THIS SOFTWARE 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. ++##- @Description:CI ++##- @Author: wangfengtu ++##- @Create: 2022-08-13 ++####################################################################### ++ ++source ../helpers.sh ++curr_path=$(dirname $(readlink -f "$0")) ++data_path=$(realpath $curr_path/criconfigs) ++pause_img_path=$(realpath $curr_path/test_data) ++ ++function do_pre() ++{ ++ sed -i "s#seccomp_localhost_ref#${data_path}/seccomp_localhost.json#g" ${data_path}/container-config-seccomp-localhost.json ++ ++ init_cri_conf $1 "without_valgrind" ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to init cri conf: ${1}" && return ${FAILURE} ++ ++ isula pull busybox ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pull busybox" && return ${FAILURE} ++ ++ return 0 ++} ++ ++function do_post() ++{ ++ local ret=0 ++ restore_cri_conf "without_valgrind" ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to restore cri conf" && ((ret++)) ++ return $ret ++} ++ ++function test_cri_stats() ++{ ++ local ret=0 ++ local test="cri stats test => (${FUNCNAME[@]})" ++ ++ msg_info "${test} starting..." ++ ++ sid=$(crictl runp ${data_path}/sandbox-config.json) ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run sandbox" && ((ret++)) ++ ++ cid=$(crictl create $sid ${data_path}/container-config.json ${data_path}/sandbox-config.json) ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to create container" && ((ret++)) ++ ++ crictl start $cid ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to start container" && ((ret++)) ++ ++ crictl statsp $sid ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to get cri stats" && ((ret++)) ++ ++ crictl stats $cid ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to get cri stats" && ((ret++)) ++ ++ msg_info "${test} finished with return ${ret}..." ++ return ${ret} ++} ++ ++declare -i ans=0 ++ ++for version in ${CRI_LIST[@]}; ++do ++ test="test_cri_test_fun, use cri version => (${version})" ++ msg_info "${test} starting..." ++ ++ do_pre $version || ((ans++)) ++ ++ test_cri_stats || ((ans++)) ++ ++ do_post || ((ans++)) ++ msg_info "${test} finished with return ${ans}..." ++done ++ ++show_result ${ans} "${curr_path}/${0}" ++ +diff --git a/CI/test_cases/container_cases/cri_test.sh b/CI/test_cases/container_cases/cri_test.sh +index ed333a28..6dc2291e 100755 +--- a/CI/test_cases/container_cases/cri_test.sh ++++ b/CI/test_cases/container_cases/cri_test.sh +@@ -45,6 +45,83 @@ function do_post() + return $ret + } + ++function test_cri_info() ++{ ++ local ret=0 ++ local image="busybox" ++ local test="cri info test => (${FUNCNAME[@]})" ++ ++ msg_info "${test} starting..." ++ ++ crictl info ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to get cri info" && ((ret++)) ++ ++ msg_info "${test} finished with return ${ret}..." ++ return ${ret} ++} ++ ++function test_cri_list() ++{ ++ local ret=0 ++ local image="busybox" ++ local test="cri list test => (${FUNCNAME[@]})" ++ ++ msg_info "${test} starting..." ++ ++ sid=$(crictl runp ${data_path}/sandbox-config.json) ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run sandbox" && ((ret++)) ++ ++ cid=$(crictl create $sid ${data_path}/container-config.json ${data_path}/sandbox-config.json) ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to create container" && ((ret++)) ++ ++ crictl start $cid ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to start container" && ((ret++)) ++ ++ crictl pods | grep "^${sid:0:5}" ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to list cri pod" && ((ret++)) ++ ++ crictl ps -a | grep "^${cid:0:5}" ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to list cri container" && ((ret++)) ++ ++ stop_isulad_without_valgrind ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop isulad failed" && ((ret++)) ++ ++ start_isulad_without_valgrind ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop isulad failed" && ((ret++)) ++ ++ crictl ps -a | grep "^${cid:0:5}" ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to list cri container after restart" && ((ret++)) ++ ++ crictl pods | grep "^${sid:0:5}" ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to list cri pod after restart" && ((ret++)) ++ ++ crictl rmp -f $(crictl pods -q) ++ ++ msg_info "${test} finished with return ${ret}..." ++ return ${ret} ++} ++ ++function test_cri_images() ++{ ++ local ret=0 ++ local image="busybox" ++ local test="cri images test => (${FUNCNAME[@]})" ++ ++ msg_info "${test} starting..." ++ ++ crictl pull $image ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pull image" && ((ret++)) ++ ++ crictl images | grep $image ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to list cri images" && ((ret++)) ++ ++ crictl rmi $image ++ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to remove image" && ((ret++)) ++ ++ msg_info "${test} finished with return ${ret}..." ++ return ${ret} ++} ++ + function test_cri_seccomp() + { + local ret=0 +@@ -97,6 +174,9 @@ do + test_cri_seccomp "default" || ((ans++)) + test_cri_seccomp "unconfined" || ((ans++)) + test_cri_seccomp "localhost" || ((ans++)) ++ test_cri_info || ((ans++)) ++ test_cri_list || ((ans++)) ++ test_cri_images || ((ans++)) + + do_post || ((ans++)) + msg_info "${test} finished with return ${ans}..." +-- +2.34.1 + |