summaryrefslogtreecommitdiff
path: root/0020-add-crictl-timeout-and-sync-for-CI.patch
blob: dbab1fdf4f0d0c3b32842ead59f8fd065e0bc340 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
From 7941e0fcd8d7b8edb303a1661233fd9688c46819 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Mon, 20 Feb 2023 15:42:40 +0800
Subject: [PATCH 20/53] add crictl timeout and sync for CI

Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
 CI/test_cases/container_cases/bigdata_stream.sh      | 7 +++++++
 CI/test_cases/container_cases/bigdata_stream_runc.sh | 4 ++++
 CI/test_cases/helpers.sh                             | 5 ++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/CI/test_cases/container_cases/bigdata_stream.sh b/CI/test_cases/container_cases/bigdata_stream.sh
index 7e74d700..3bfc2d50 100755
--- a/CI/test_cases/container_cases/bigdata_stream.sh
+++ b/CI/test_cases/container_cases/bigdata_stream.sh
@@ -124,6 +124,7 @@ function test_concurrent_bigdata_stream()
         pids[${#pids[@]}]=$!
     done
     wait ${pids[*]// /|}
+    sync && sync
 
     for index in $(seq 1 5); do
         ls -l /home/iocopy_stream_data_500M_$index
@@ -151,6 +152,7 @@ function test_concurrent_bigdata_stream_without_pty()
         pids[${#pids[@]}]=$!
     done
     wait ${pids[*]// /|}
+    sync && sync
 
     for index in $(seq 1 5); do
         ls -l /home/iocopy_stream_data_500M_$index
@@ -209,6 +211,7 @@ function test_stream_with_stop_client()
     kill -18 $pid
 
     wait $pid
+    sync && sync
 
     ls -l /home/iocopy_stream_data_500M
     total_size=$(stat -c"%s" /home/iocopy_stream_data_500M)
@@ -254,6 +257,7 @@ function test_stream_with_stop_attach()
     kill -18 $pid
 
     wait $exec_pid
+    sync && sync
 
     ls -l /home/iocopy_stream_data_500M
     total_size=$(stat -c"%s" /home/iocopy_stream_data_500M)
@@ -299,6 +303,7 @@ function test_stream_with_stop_lxc_monitor()
     kill -18 $pid
 
     wait $exec_pid
+    sync && sync
 
     ls -l /home/iocopy_stream_data_500M
     total_size=$(stat -c"%s" /home/iocopy_stream_data_500M)
@@ -347,6 +352,7 @@ function test_stream_with_stop_isulad()
     kill -18 $(cat /var/run/isulad.pid)
 
     wait $pid
+    sync && sync
 
     ls -l /home/iocopy_stream_data_500M
     total_size=$(stat -c"%s" /home/iocopy_stream_data_500M)
@@ -397,6 +403,7 @@ function test_stream_with_runc()
     isula exec -it $RUNCID cat test_500M > /home/iocopy_stream_data_500M
     [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to cat bigdata" && ((ret++))
 
+    sync && sync
     total_size=$(stat -c"%s" /home/iocopy_stream_data_500M)
     [[ $total_size -ne 524288000 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stream iocopy loss data" && ((ret++))
 
diff --git a/CI/test_cases/container_cases/bigdata_stream_runc.sh b/CI/test_cases/container_cases/bigdata_stream_runc.sh
index 6933bef0..3a384cd8 100755
--- a/CI/test_cases/container_cases/bigdata_stream_runc.sh
+++ b/CI/test_cases/container_cases/bigdata_stream_runc.sh
@@ -117,6 +117,7 @@ function test_cat_bigdata()
         pids[${#pids[@]}]=$!
     done
     wait ${pids[*]// /|}
+    sync && sync
 
     for index in $(seq 1 5); do
         ls -l /home/iocopy_stream_data_500M_$index
@@ -144,6 +145,7 @@ function test_cat_bigdata_without_pty()
         pids[${#pids[@]}]=$!
     done
     wait ${pids[*]// /|}
+    sync && sync
 
     for index in $(seq 1 5); do
         ls -l /home/iocopy_stream_data_500M_$index
@@ -173,6 +175,7 @@ function test_stream_with_stop_client()
     kill -18 $pid
 
     wait $pid
+    sync && sync
 
     ls -l /home/iocopy_stream_data_500M
     total_size=$(stat -c"%s" /home/iocopy_stream_data_500M)
@@ -217,6 +220,7 @@ function test_stream_with_stop_isulad()
     kill -18 $(cat /var/run/isulad.pid)
 
     wait $pid
+    sync && sync
 
     ls -l /home/iocopy_stream_data_500M
     total_size=$(stat -c"%s" /home/iocopy_stream_data_500M)
diff --git a/CI/test_cases/helpers.sh b/CI/test_cases/helpers.sh
index bba4e7e3..5ea4ff94 100755
--- a/CI/test_cases/helpers.sh
+++ b/CI/test_cases/helpers.sh
@@ -69,7 +69,10 @@ function testcontainer() {
 
 function crictl() {
     CRICTL=$(which crictl)
-    "$CRICTL" -i unix:///var/run/isulad.sock -r unix:///var/run/isulad.sock "$@"
+    # Default timeout is 2s.
+    # In some high IO testcase, isulad handle CRI request time maybe more than 2s.
+    # And the crictl will print error message "context deadline exceeded"
+    "$CRICTL" -i unix:///var/run/isulad.sock -r unix:///var/run/isulad.sock --timeout 5s "$@"
 }
 
 function msg_ok()
-- 
2.25.1