blob: 2256aba2c6c57cee363e52fdc8fc5c1d22002286 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
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
|