1 Star 0 Fork 44

严莹/iSulad

forked from src-openEuler/iSulad 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0018-add-concurrent-load-test.patch 2.30 KB
一键复制 编辑 原始数据 按行查看 历史
jake 提交于 2024-04-02 11:50 . upgrade from upstream
From 2af906d42a155a7b779dce017a2779b96dba2b61 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Fri, 1 Mar 2024 15:04:35 +0800
Subject: [PATCH 18/43] add concurrent load test
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
CI/test_cases/image_cases/image_load.sh | 47 +++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/CI/test_cases/image_cases/image_load.sh b/CI/test_cases/image_cases/image_load.sh
index 52b713d4..a2cada5f 100755
--- a/CI/test_cases/image_cases/image_load.sh
+++ b/CI/test_cases/image_cases/image_load.sh
@@ -79,8 +79,55 @@ function test_image_load()
return ${ret}
}
+function test_concurrent_load()
+{
+ local ret=0
+ local test="isula load image test => (${FUNCNAME[@]})"
+
+ msg_info "${test} starting..."
+
+ # clean exist image
+ ubuntu_id=`isula inspect -f '{{.image.id}}' ubuntu`
+ busybox_id=`isula inspect -f '{{.image.id}}' busybox`
+ isula rmi $ubuntu_id $busybox_id
+
+ concurrent_time=10
+ for i in `seq 1 $concurrent_time`
+ do
+ isula load -i $mult_image &
+ pids[$i]=$!
+ done
+
+ for i in `seq 1 $concurrent_time`;do
+ wait ${pids[$i]}
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - fail to do isulad load $i" && ((ret++))
+ done
+
+ ubuntu_id=`isula inspect -f '{{.image.id}}' ubuntu`
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - fail to inspect image: ubuntu" && ((ret++))
+
+ top_layer_id=$(isula inspect -f '{{.image.top_layer}}' ${ubuntu_id})
+
+ busybox_id=`isula inspect -f '{{.image.id}}' busybox`
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - fail to inspect image: busybox" && ((ret++))
+
+ # delete image after concurrent load
+ isula rmi $ubuntu_id $busybox_id
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to remove image ${ubuntu_id} and ${busybox_id}" && ((ret++))
+
+ ls -l /var/lib/isulad/storage/overlay-layers
+ local top_layer_dir=/var/lib/isulad/storage/overlay-layers/${top_layer_id}
+ test -e ${top_layer_dir}
+ [[ $? -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - top layer dir ${top_layer_id} exist after delete image" && ((ret++))
+
+ msg_info "${test} finished with return ${ret}..."
+ return ${ret}
+}
+
declare -i ans=0
+test_concurrent_load || ((ans++))
+
test_image_load || ((ans++))
show_result ${ans} "${curr_path}/${0}"
--
2.34.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yanyir/iSulad.git
git@gitee.com:yanyir/iSulad.git
yanyir
iSulad
iSulad
master

搜索帮助