94 lines
3.3 KiB
Diff
94 lines
3.3 KiB
Diff
From 513530a98d627ae84b1415f93af5bc298b39ba9d Mon Sep 17 00:00:00 2001
|
|
From: WangFengTu <wangfengtu@huawei.com>
|
|
Date: Mon, 8 Feb 2021 16:38:22 +0800
|
|
Subject: [PATCH 32/53] fd leak check in cp.sh should not include pull fd check
|
|
|
|
pull may increase fd, we can check pull fd leak in registry.sh
|
|
|
|
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
|
---
|
|
CI/test_cases/container_cases/cp.sh | 14 ++++++++------
|
|
CI/test_cases/image_cases/registry.sh | 21 +++++++++++++++++++++
|
|
2 files changed, 29 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/CI/test_cases/container_cases/cp.sh b/CI/test_cases/container_cases/cp.sh
|
|
index 09b6ddff..fef637a5 100644
|
|
--- a/CI/test_cases/container_cases/cp.sh
|
|
+++ b/CI/test_cases/container_cases/cp.sh
|
|
@@ -328,18 +328,19 @@ function cp_test_t()
|
|
|
|
msg_info "${test} starting..."
|
|
|
|
+ isula inspect ${image}
|
|
+ if [ x"$?" != x"0" ];then
|
|
+ isula pull ${image}
|
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pull image: ${image}" && return ${FAILURE}
|
|
+ fi
|
|
+
|
|
local isulad_pid=$(cat /var/run/isulad.pid)
|
|
|
|
# wait some time to make sure fd closed
|
|
sleep 3
|
|
local fd_num1=$(ls -l /proc/$isulad_pid/fd | wc -l)
|
|
[[ $fd_num1 -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - can not get fd number" && ((ret++))
|
|
-
|
|
- isula inspect ${image}
|
|
- if [ x"$?" != x"0" ];then
|
|
- isula pull ${image}
|
|
- [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pull image: ${image}" && return ${FAILURE}
|
|
- fi
|
|
+ ls -l /proc/$isulad_pid/fd
|
|
|
|
isula images | grep busybox
|
|
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++))
|
|
@@ -369,6 +370,7 @@ function cp_test_t()
|
|
sleep 3
|
|
local fd_num2=$(ls -l /proc/$isulad_pid/fd | wc -l)
|
|
[[ $fd_num2 -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - can not get fd number" && ((ret++))
|
|
+ ls -l /proc/$isulad_pid/fd
|
|
|
|
# make sure fd not increase after test
|
|
[[ $fd_num1 -ne $fd_num2 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - fd number not right" && ((ret++))
|
|
diff --git a/CI/test_cases/image_cases/registry.sh b/CI/test_cases/image_cases/registry.sh
|
|
index 042b1f4a..4e6adc28 100755
|
|
--- a/CI/test_cases/image_cases/registry.sh
|
|
+++ b/CI/test_cases/image_cases/registry.sh
|
|
@@ -26,6 +26,18 @@ source ../helpers.sh
|
|
function isula_pull()
|
|
{
|
|
isula rm -f `isula ps -a -q`
|
|
+
|
|
+ isula pull busybox
|
|
+ fn_check_eq "$?" "0" "isula pull busybox"
|
|
+
|
|
+ local isulad_pid=$(cat /var/run/isulad.pid)
|
|
+
|
|
+ # wait some time to make sure fd closed
|
|
+ sleep 3
|
|
+ local fd_num1=$(ls -l /proc/$isulad_pid/fd | wc -l)
|
|
+ [[ $fd_num1 -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - can not get fd number" && ((ret++))
|
|
+ ls -l /proc/$isulad_pid/fd
|
|
+
|
|
isula rmi busybox
|
|
|
|
for i in `seq 1 10`
|
|
@@ -36,6 +48,15 @@ function isula_pull()
|
|
fn_check_eq "$?" "0" "isula pull busybox"
|
|
wait
|
|
|
|
+ # wait some time to make sure fd closed
|
|
+ sleep 3
|
|
+ local fd_num2=$(ls -l /proc/$isulad_pid/fd | wc -l)
|
|
+ [[ $fd_num2 -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - can not get fd number" && ((ret++))
|
|
+ ls -l /proc/$isulad_pid/fd
|
|
+
|
|
+ # make sure fd not increase after remove and pull busybox
|
|
+ [[ $fd_num1 -ne $fd_num2 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - fd number not right" && ((ret++))
|
|
+
|
|
isula inspect busybox
|
|
fn_check_eq "$?" "0" "isula inspect busybox"
|
|
|
|
--
|
|
2.25.1
|
|
|