1 Star 0 Fork 46

wangfengtu/src-iSulad

forked from src-openEuler/iSulad 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0010-add-nonroot-execute-CI.patch 2.98 KB
一键复制 编辑 原始数据 按行查看 历史
gaohuatao 提交于 2020-11-12 19:32 . update from openeuler
From 79b2027b87dd1b7f110d73721b8d47941d993e0e Mon Sep 17 00:00:00 2001
From: gaohuatao <[email protected]>
Date: Mon, 26 Oct 2020 13:57:07 +0800
Subject: [PATCH 10/28] add nonroot execute CI
Signed-off-by: gaohuatao <[email protected]>
---
CI/test_cases/container_cases/nonroot.sh | 70 ++++++++++++++++++++++++
1 file changed, 70 insertions(+)
create mode 100755 CI/test_cases/container_cases/nonroot.sh
diff --git a/CI/test_cases/container_cases/nonroot.sh b/CI/test_cases/container_cases/nonroot.sh
new file mode 100755
index 0000000..b123d70
--- /dev/null
+++ b/CI/test_cases/container_cases/nonroot.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+# attributes: isulad inheritance start
+# concurrent: YES
+# spend time: 11
+
+#######################################################################
+##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
+# - iSulad licensed under the Mulan PSL v2.
+# - You can use this software according to the terms and conditions of the Mulan PSL v2.
+# - You may obtain a copy of Mulan PSL v2 at:
+# - http://license.coscl.org.cn/MulanPSL2
+# - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
+# - IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
+# - PURPOSE.
+# - See the Mulan PSL v2 for more details.
+##- @Description:CI
+##- @Author: gaohuatao
+##- @Create: 2020-10-19
+#######################################################################
+
+curr_path=$(dirname $(readlink -f "$0"))
+data_path=$(realpath $curr_path/../data)
+source ../helpers.sh
+group="isula"
+user="nonroot_test"
+container="test_nonroot_user"
+
+function do_test_t()
+{
+ local ret=0
+ local test="isula execute with non root => (${FUNCNAME[@]})"
+
+ msg_info "${test} starting..."
+
+ userdel $user
+ useradd -g $group $user
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - add user $user and add to group $group failed" && ((ret++))
+
+ su - $user -c "isula run -tid --name $container busybox /bin/bash"
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - run container failed" && ((ret++))
+
+ su - $user -c "isula inspect $container"
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - inspect container failed" && ((ret++))
+
+ su - $user -c "isula restart $container"
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - restart container failed" && ((ret++))
+
+ su - $user -c "isula exec $container pwd"
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - exec container failed" && ((ret++))
+
+ su - $user -c "isula stop $container"
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop container failed" && ((ret++))
+
+ su - $user -c "isula rm $container"
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - rm container failed" && ((ret++))
+
+ userdel $user
+
+ return $TC_RET_T
+}
+
+ret=0
+
+do_test_t
+if [ $? -ne 0 ];then
+ let "ret=$ret + 1"
+fi
+
+show_result $ret "basic start"
--
2.20.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangfengtu/src-iSulad.git
[email protected]:wangfengtu/src-iSulad.git
wangfengtu
src-iSulad
src-iSulad
master

搜索帮助