iSulad/0146-2195-Add-retry-function-for-bigdata_stream_runc.patch
openeuler-sync-bot 955d185c18 !645 [sync] PR-641: upgrade from upstream
* upgrade from upstream
2023-12-22 01:09:39 +00:00

59 lines
1.8 KiB
Diff

From c7497b9267e7d1a90302260768421d473e3d238d Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Mon, 18 Sep 2023 13:02:04 +0000
Subject: [PATCH 146/181] !2195 Add retry function for bigdata_stream_runc *
Add retry function for bigdata_stream_runc
---
.../container_cases/bigdata_stream_runc.sh | 20 +++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/CI/test_cases/container_cases/bigdata_stream_runc.sh b/CI/test_cases/container_cases/bigdata_stream_runc.sh
index 3a384cd8..dce9ccb4 100755
--- a/CI/test_cases/container_cases/bigdata_stream_runc.sh
+++ b/CI/test_cases/container_cases/bigdata_stream_runc.sh
@@ -21,6 +21,20 @@
declare -r curr_path=$(dirname $(readlink -f "$0"))
source ../helpers.sh
+# $1 : retry limit
+# $2 : retry_interval
+function do_retry_check_residual()
+{
+ for i in $(seq 1 "$1"); do
+ ps aux | grep "cat test_" | grep -v "grep"
+ if [ $? -ne 0 ]; then
+ return 0
+ fi
+ sleep $2
+ done
+ return 1
+}
+
function set_up()
{
local ret=0
@@ -65,6 +79,8 @@ function record_origin_status()
function check_last_status()
{
local ret=0
+ local retry_limit=20
+ local retry_interval=1
sleep 5
ps -T -p $(cat /var/run/isulad.pid) | grep IoCopy
[[ $? -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - IOCopy Thread residue" && ((ret++))
@@ -97,8 +113,8 @@ function check_last_status()
msg_err "${FUNCNAME[0]}:${LINENO} - client not exit!!" && ((ret++))
fi
- ps aux | grep "cat test_" | grep -v "grep"
- if [[ $? -eq 0 ]]; then
+ do_retry_check_residual ${retry_limit} ${retry_interval}
+ if [[ $? -ne 0 ]]; then
msg_err "${FUNCNAME[0]}:${LINENO} - business process residual" && ((ret++))
fi
--
2.42.0