1 Star 0 Fork 43

zhongtao/src-iSulad

forked from src-openEuler/iSulad 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0116-fix-bug-in-ci-test.patch 1.85 KB
一键复制 编辑 原始数据 按行查看 历史
zhongtao 提交于 2024-08-19 10:17 . add impl for nri and bugfix
From c7cf33c432b3d9479b2fe365169d4b9a37cae8f7 Mon Sep 17 00:00:00 2001
From: jikai <[email protected]>
Date: Tue, 9 Jul 2024 12:30:01 +0000
Subject: [PATCH 116/121] fix bug in ci test
Signed-off-by: jikai <[email protected]>
---
CI/test_cases/container_cases/run.sh | 6 +++---
CI/test_cases/helpers.sh | 5 +++--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/CI/test_cases/container_cases/run.sh b/CI/test_cases/container_cases/run.sh
index 1bfd388b..ef04b547 100755
--- a/CI/test_cases/container_cases/run.sh
+++ b/CI/test_cases/container_cases/run.sh
@@ -26,9 +26,9 @@ source ../helpers.sh
function do_test_t()
{
tid=`isula run --runtime $1 -tid --name hostname busybox`
- chostname=`isula exec -it $tid hostname`
- clean_hostname=$(echo "$hostname" | sed 's/[\x01-\x1F\x7F]//g')
- fn_check_eq "${clean_hostname}" "${tid:0:12}" "default hostname is not id of container"
+ # should not use -it option, otherwise the hostname will containe special characters such as '$' or '\r'
+ hostname=`isula exec $tid hostname`
+ fn_check_eq "${hostname}" "${tid:0:12}" "default hostname is not id of container"
isula exec -it hostname env | grep HOSTNAME
fn_check_eq "$?" "0" "check HOSTNAME env failed"
isula stop -t 0 $tid
diff --git a/CI/test_cases/helpers.sh b/CI/test_cases/helpers.sh
index c5eba8a2..0288b4ea 100755
--- a/CI/test_cases/helpers.sh
+++ b/CI/test_cases/helpers.sh
@@ -52,15 +52,16 @@ function cut_output_lines() {
return $retval
}
+# use string compare to check the result
function fn_check_eq() {
- if [[ "$1" -ne "$2" ]];then
+ if [ "x$1" != "x$2" ];then
echo "$3"
TC_RET_T=$(($TC_RET_T+1))
fi
}
function fn_check_ne() {
- if [[ "$1" -eq "$2" ]];then
+ if [[ "x$1" == "x$2" ]];then
echo "$3"
TC_RET_T=$(($TC_RET_T+1))
fi
--
2.25.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/taotao-sauce/src-iSulad.git
[email protected]:taotao-sauce/src-iSulad.git
taotao-sauce
src-iSulad
src-iSulad
master

搜索帮助