Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
2b7c40b9
I
iSulad
项目概览
openeuler
/
iSulad
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2b7c40b9
编写于
5月 19, 2020
作者:
L
lifeng68
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CI: add container test cases
Signed-off-by:
N
lifeng68
<
lifeng68@huawei.com
>
上级
c9207b9e
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
1617 addition
and
0 deletion
+1617
-0
CI/test_cases/container_cases/check_fd_leakage_of_isulad.bash
...est_cases/container_cases/check_fd_leakage_of_isulad.bash
+132
-0
CI/test_cases/container_cases/cni_test.bash
CI/test_cases/container_cases/cni_test.bash
+155
-0
CI/test_cases/container_cases/create.bash
CI/test_cases/container_cases/create.bash
+83
-0
CI/test_cases/container_cases/create_mtab_test.bash
CI/test_cases/container_cases/create_mtab_test.bash
+48
-0
CI/test_cases/container_cases/criconfigs/bins/isulad-cni
CI/test_cases/container_cases/criconfigs/bins/isulad-cni
+23
-0
CI/test_cases/container_cases/criconfigs/bridge.json
CI/test_cases/container_cases/criconfigs/bridge.json
+10
-0
CI/test_cases/container_cases/criconfigs/container-config.json
...st_cases/container_cases/criconfigs/container-config.json
+45
-0
CI/test_cases/container_cases/criconfigs/good.conflist
CI/test_cases/container_cases/criconfigs/good.conflist
+20
-0
CI/test_cases/container_cases/criconfigs/invalid.conflist
CI/test_cases/container_cases/criconfigs/invalid.conflist
+18
-0
CI/test_cases/container_cases/criconfigs/sandbox-config.json
CI/test_cases/container_cases/criconfigs/sandbox-config.json
+11
-0
CI/test_cases/container_cases/help.bash
CI/test_cases/container_cases/help.bash
+84
-0
CI/test_cases/container_cases/kill.bash
CI/test_cases/container_cases/kill.bash
+55
-0
CI/test_cases/container_cases/pause.bash
CI/test_cases/container_cases/pause.bash
+61
-0
CI/test_cases/container_cases/ps.bash
CI/test_cases/container_cases/ps.bash
+80
-0
CI/test_cases/container_cases/restart.bash
CI/test_cases/container_cases/restart.bash
+54
-0
CI/test_cases/container_cases/restartpolicy.bash
CI/test_cases/container_cases/restartpolicy.bash
+78
-0
CI/test_cases/container_cases/resume.bash
CI/test_cases/container_cases/resume.bash
+65
-0
CI/test_cases/container_cases/rm.bash
CI/test_cases/container_cases/rm.bash
+91
-0
CI/test_cases/container_cases/run.bash
CI/test_cases/container_cases/run.bash
+61
-0
CI/test_cases/container_cases/share_ns_test.bash
CI/test_cases/container_cases/share_ns_test.bash
+77
-0
CI/test_cases/container_cases/start.bash
CI/test_cases/container_cases/start.bash
+54
-0
CI/test_cases/container_cases/stop.bash
CI/test_cases/container_cases/stop.bash
+74
-0
CI/test_cases/container_cases/update.bash
CI/test_cases/container_cases/update.bash
+127
-0
CI/test_cases/container_cases/version.bash
CI/test_cases/container_cases/version.bash
+110
-0
src/image/oci/oci_common_operators.c
src/image/oci/oci_common_operators.c
+1
-0
未找到文件。
CI/test_cases/container_cases/check_fd_leakage_of_isulad.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance fd
# concurrent: NO
# spend time: 40
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
connect
=
"grpc"
function
do_test_t_grpc
()
{
if
[
$connect
!=
"grpc"
]
;
then
echo
"this test is designed for grpc version"
return
0
fi
sleep
1
containername
=
test_fds
isulad_pid
=
`
cat
/var/run/isulad.pid
`
precount
=
`
ls
/proc/
$isulad_pid
/fd |
wc
-l
`
isula create
-t
--name
$containername
busybox
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername
inited
sleep
1
curcount
=
`
ls
/proc/
$isulad_pid
/fd |
wc
-l
`
fn_check_eq
"
$precount
"
"
$curcount
"
"test failed"
isula start
$containername
fn_check_eq
"
$?
"
"0"
"start failed"
testcontainer
$containername
running
isula stop
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
sleep
1
curcount
=
`
ls
/proc/
$isulad_pid
/fd |
wc
-l
`
fn_check_eq
"
$precount
"
"
$curcount
"
"test failed"
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
sleep
1
curcount
=
`
ls
/proc/
$isulad_pid
/fd |
wc
-l
`
fn_check_eq
"
$precount
"
"
$curcount
"
"test failed"
return
$TC_RET_T
}
function
do_test_t_rest
()
{
if
[
$connect
!=
"rest"
]
;
then
echo
"this test is designed for rest version"
return
0
fi
sleep
1
delta_rest
=
"5"
containername
=
test_fds
isulad_pid
=
`
cat
/var/run/isulad.pid
`
precount
=
`
ls
/proc/
$isulad_pid
/fd |
wc
-l
`
isula create
-t
--name
$containername
busybox
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername
inited
sleep
1
curcount
=
`
ls
/proc/
$isulad_pid
/fd |
wc
-l
`
delta
=
$((
10
#$curcount - 10#$precount))
echo
"delta fd is
$delta
"
if
[
$delta
-
ne
0
]
&&
[
$delta
-
ne
$delta_rest
]
;
then
echo
"test failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
isula start
$containername
fn_check_eq
"
$?
"
"0"
"start failed"
testcontainer
$containername
running
isula stop
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
sleep
1
curcount
=
`
ls
/proc/
$isulad_pid
/fd |
wc
-l
`
delta
=
$((
10
#$curcount - 10#$precount))
echo
"delta fd is
$delta
"
if
[
$delta
-
ne
0
]
&&
[
$delta
-
ne
$delta_rest
]
;
then
echo
"test failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
sleep
1
curcount
=
`
ls
/proc/
$isulad_pid
/fd |
wc
-l
`
delta
=
$((
10
#$curcount - 10#$precount))
echo
"delta fd is
$delta
"
if
[
$delta
-
ne
0
]
&&
[
$delta
-
ne
$delta_rest
]
;
then
echo
"test failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
return
$TC_RET_T
}
ret
=
0
do_test_t_grpc
do_test_t_rest
if
[
$?
-
ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic check fd leak"
CI/test_cases/container_cases/cni_test.bash
0 → 100644
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad cri cni
# concurrent: NA
# spend time: 10
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/criconfigs
)
source
../helpers.bash
function
do_pre
()
{
cp
/etc/isulad/daemon.json /etc/isulad/daemon.bak
sed
-i
"s#
\"
pod-sandbox-image
\"
:
\"\"
#
\"
pod-sandbox-image
\"
:
\"
rancher/pause-amd64:3.0
\"
#g"
/etc/isulad/daemon.json
init_cni_conf
$data_path
if
[
$?
-ne
0
]
;
then
msg_err
"Failed to init cni config"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
return
$TC_RET_T
fi
}
function
do_post
()
{
cp
-f
/etc/isulad/daemon.bak /etc/isulad/daemon.json
stop_isulad_without_valgrind
start_isulad_without_valgrind
}
function
do_test_help
()
{
msg_info
"this is
$0
do_test"
crictl images |
grep
busybox
if
[
$?
-ne
0
]
;
then
msg_err
"Failed to find busybox image"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
sid
=
`
crictl runp
${
data_path
}
/sandbox-config.json
`
if
[
$?
-ne
0
]
;
then
msg_err
"Failed to run sandbox"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
spid
=
`
isula inspect
-f
'{{json .State.Pid}}'
$sid
`
nsenter
-t
$spid
-n
ifconfig eth0
if
[
$?
-ne
0
]
;
then
msg_err
"Sandbox network config failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
cid
=
`
crictl create
$sid
${
data_path
}
/container-config.json
${
data_path
}
/sandbox-config.json
`
if
[
$?
-ne
0
]
;
then
msg_err
"create container failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
crictl start
$cid
if
[
$?
-ne
0
]
;
then
msg_err
"start container failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
# check whether container use pod network namespace
pod_pid
=
`
isula inspect
-f
'{{json .State.Pid}}'
$sid
`
pod_net_ns_id
=
`
ls
-l
/proc/
${
pod_pid
}
/ns/net |
awk
-F
[
'{print $2}'
|awk
-F
]
'{print $1}'
`
con_pid
=
`
isula inspect
-f
'{{json .State.Pid}}'
$cid
`
con_net_ns_id
=
`
ls
-l
/proc/
${
con_pid
}
/ns/net |
awk
-F
[
'{print $2}'
|awk
-F
]
'{print $1}'
`
if
[
"
$pod_net_ns_id
"
!=
"
$con_net_ns_id
"
]
;
then
msg_err
"Pod and container use different network namespace"
nsenter
-t
$pod_pid
-n
ifconfig eth0
nsenter
-t
$con_pid
-n
ifconfig eth0
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
nsenter
-t
$pod_pid
-n
ifconfig eth0 |
grep
"
$1
"
if
[
$?
-ne
0
]
;
then
msg_err
"expect ip:
$1
, get: "
nsenter
-t
$pod_pid
-n
ifconfig eth0
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
crictl stop
$cid
if
[
$?
-ne
0
]
;
then
msg_err
"stop container failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
crictl
rm
$cid
if
[
$?
-ne
0
]
;
then
msg_err
"stop container failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
crictl stopp
$sid
if
[
$?
-ne
0
]
;
then
msg_err
"stop sandbox failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
crictl rmp
$sid
if
[
$?
-ne
0
]
;
then
msg_err
"rm sandbox failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
return
$TC_RET_T
}
function
default_cni_config
()
{
do_test_help
"10
\.
1
\.
"
}
function
new_cni_config
()
{
cp
${
data_path
}
/bridge.json /etc/cni/net.d/
sync
;
sync
;
tail
$ISUALD_LOG
# wait cni updated
s
=
`
date
"+%s"
`
for
((
i
=
0
;
i<30
;
i++
))
;
do
sleep
1
cur
=
`
date
"+%s"
`
let
"t=cur-s"
if
[
$t
-gt
6
]
;
then
break
fi
done
tail
$ISUALD_LOG
do_test_help
"10
\.
2
\.
"
}
ret
=
0
do_pre
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
default_cni_config
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
new_cni_config
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
do_post
show_result
$ret
"cni base test"
CI/test_cases/container_cases/create.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance create
# concurrent: YES
# spend time: 8
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
source
../helpers.bash
function
do_test_t
()
{
containername
=
test_create
isula run
-itd
--name
$containername
busybox
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername
running
isula
rm
-f
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
isula inspect
$containername
fn_check_ne
"
$?
"
"0"
"inspect should fail"
containerid
=
`
isula run
-itd
--name
$containername
--cpu-shares
1024 busybox
`
fn_check_eq
"
$?
"
"0"
"create failed"
cat
"
$LCR_ROOT_PATH
/
$containerid
/config"
|
grep
"cpu.shares = 1024"
fn_check_eq
"
$?
"
"0"
"create failed"
isula
rm
-f
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
containerid
=
`
isula run
-itd
--name
$containername
--cpu-quota
50000 busybox
`
fn_check_eq
"
$?
"
"0"
"create failed"
cat
"
$LCR_ROOT_PATH
/
$containerid
/config"
|
grep
"cpu.cfs_quota_us = 50000"
fn_check_eq
"
$?
"
"0"
"create failed"
isula
rm
-f
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
containerid
=
`
isula run
-itd
--name
$containername
--cpuset-cpus
0-1 busybox
`
fn_check_eq
"
$?
"
"0"
"create failed"
cat
"
$LCR_ROOT_PATH
/
$containerid
/config"
|
grep
"cpuset.cpus = 0-1"
fn_check_eq
"
$?
"
"0"
"create failed"
isula
rm
-f
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
containerid
=
`
isula run
-itd
--name
$containername
--memory
1000000000 busybox
`
fn_check_eq
"
$?
"
"0"
"create failed"
cat
"
$LCR_ROOT_PATH
/
$containerid
/config"
|
grep
"memory.limit_in_bytes = 1000000000"
fn_check_eq
"
$?
"
"0"
"create failed"
isula
rm
-f
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic create"
CI/test_cases/container_cases/create_mtab_test.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/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-05-11
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
do_test_t
()
{
id
=
`
isula run
-tid
--runtime
runc busybox
`
fn_check_eq
"
$?
"
"0"
"run failed"
testcontainer
$id
running
isula
exec
$id
sh
-c
'ls -al /etc/mtab'
fn_check_eq
"
$?
"
"0"
"/etc/mtab not exist"
isula
rm
-f
$id
fn_check_eq
"
$?
"
"0"
"rm failed"
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"creat mtab symbol link"
CI/test_cases/container_cases/criconfigs/bins/isulad-cni
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
basepath
=
/tmp/cnilogs/
mkdir
-p
$basepath
secs
=
`
date
"+%s"
`
confpath
=
${
basepath
}
/
${
secs
}
.netconf
envpath
=
${
basepath
}
/
${
secs
}
.env
env
|
grep
CNI_CONTAINERID
>
/dev/null 2>&1
if
[
$?
-eq
0
]
;
then
confpath
=
${
basepath
}
/
${
CNI_CONTAINERID
}
.netconf
envpath
=
${
basepath
}
/
${
CNI_CONTAINERID
}
.env
fi
read
-r
line
echo
$line
>
${
confpath
}
env
>
${
envpath
}
echo
"{
\"
cniVersion
\"
:
\"
0.3.1
\"
,
\"
dns
\"
: {}
}"
CI/test_cases/container_cases/criconfigs/bridge.json
0 → 100644
浏览文件 @
2b7c40b9
{
"cniVersion"
:
"0.3.0"
,
"name"
:
"ok"
,
"type"
:
"bridge"
,
"bridge"
:
"cni0"
,
"ipam"
:
{
"type"
:
"host-local"
,
"subnet"
:
"10.2.0.0/16"
}
}
CI/test_cases/container_cases/criconfigs/container-config.json
0 → 100644
浏览文件 @
2b7c40b9
{
"metadata"
:
{
"name"
:
"haozi"
},
"image"
:{
"image"
:
"busybox:latest"
},
"command"
:
[
"/bin/sh"
,
"-c"
,
"i=0; while true; do echo
\"
$i: $(date)
\"
; i=$((i+1)); sleep 10; done"
],
"labels"
:
{
"filter_label_key"
:
"filter_label_val"
},
"annotations"
:
{
"extension.network.kubernetes.io/cni/instancename"
:
"pod_instance_name"
},
"mounts"
:
[
{
"container_path"
:
"/tmp/contpath"
,
"host_path"
:
"/tmp/hostpath"
,
"readonly"
:
true
,
"selinux_relabel"
:
true
,
"propagation"
:
0
},
{
"container_path"
:
"/tmp/contpath2"
,
"host_path"
:
"/tmp/hostpath2"
,
"readonly"
:
false
,
"selinux_relabel"
:
false
,
"propagation"
:
0
}
],
"linux"
:
{
"security_context"
:
{
"namespace_options"
:
{
"host_network"
:
true
,
"host_pid"
:
false
,
"host_ipc"
:
false
}
}
},
"log_path"
:
"cri_test.log"
}
CI/test_cases/container_cases/criconfigs/good.conflist
0 → 100644
浏览文件 @
2b7c40b9
{
"cniVersion": "0.3.1",
"name": "good",
"plugins": [
{
"name": "good",
"type": "ptp",
"ipam": {
"type": "host-local",
"subnet": "10.1.0.0/16"
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
}
}
]
}
CI/test_cases/container_cases/criconfigs/invalid.conflist
0 → 100644
浏览文件 @
2b7c40b9
{
"cniVersion": "0.3.1",
"name": 666,
"plugins": [
{
"name": "default",
"type": "ptp",
"ipam": {
"type": "host-local",
"subnet": "10.1.0.0/16"
}
},
{
"type": "portmap",
"capabilities": {"portMappings": true}
}
]
}
CI/test_cases/container_cases/criconfigs/sandbox-config.json
0 → 100644
浏览文件 @
2b7c40b9
{
"port_mappings"
:[{
"protocol"
:
1
,
"container_port"
:
80
,
"host_port"
:
8080
}],
"metadata"
:
{
"name"
:
"test"
,
"namespace"
:
"default"
,
"attempt"
:
1
,
"uid"
:
"hdishd83djaidwnduwk28bcsb"
},
"linux"
:
{
}
}
CI/test_cases/container_cases/help.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance help
# concurrent: YES
# spend time: 1
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
isulad_help
()
{
isulad
--help
fn_check_eq
"
$?
"
"0"
"test failed"
}
function
isula_help
()
{
isula
fn_check_eq
"
$?
"
"0"
"test failed"
isula
--help
fn_check_eq
"
$?
"
"0"
"test failed"
}
function
isula_subcmd_help
()
{
isula create
--help
fn_check_eq
"
$?
"
"0"
"test failed"
isula
rm
--help
fn_check_eq
"
$?
"
"0"
"test failed"
isula ps
--help
fn_check_eq
"
$?
"
"0"
"test failed"
isula start
--help
fn_check_eq
"
$?
"
"0"
"test failed"
isula stop
--help
fn_check_eq
"
$?
"
"0"
"test failed"
isula
exec
--help
fn_check_eq
"
$?
"
"0"
"test failed"
isula version
--help
fn_check_eq
"
$?
"
"0"
"test failed"
isula foo
--help
fn_check_ne
"
$?
"
"0"
"test failed"
}
function
do_test_t
()
{
isulad_help
isula_help
isula_subcmd_help
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic help"
CI/test_cases/container_cases/kill.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance kill
# concurrent: YES
# spend time: 4
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
do_test_t
()
{
containername
=
test_kill
isula create
-t
--name
$containername
busybox
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername
inited
isula start
$containername
fn_check_eq
"
$?
"
"0"
"start failed"
testcontainer
$containername
running
isula
kill
$containername
fn_check_eq
"
$?
"
"0"
"kill failed"
sleep
2
testcontainer
$containername
exited
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic kill"
CI/test_cases/container_cases/pause.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance pause
# concurrent: YES
# spend time: 1
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
do_test_t
()
{
echo
"Do not support pause function now"
return
0
containername
=
test_pause
isula create
-t
--name
$containername
busybox
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername
inited
isula pause
$containername
fn_check_ne
"
$?
"
"0"
"pause should fail"
testcontainer
$containername
inited
isula start
$containername
fn_check_eq
"
$?
"
"0"
"start failed"
testcontainer
$containername
running
isula pause
$containername
fn_check_eq
"
$?
"
"0"
"pause failed"
testcontainer
$containername
paused
isula
rm
-f
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic pause"
CI/test_cases/container_cases/ps.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance ps list
# concurrent: NO
# spend time: 14
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
do_test_t
()
{
containername
=
test_list
containername2
=
test_list2
containername3
=
test_list3
isula create
-t
--name
$containername
busybox
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername
inited
isula create
-t
--name
$containername2
busybox
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername2
inited
isula create
-t
--name
$containername3
busybox
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername3
inited
# start container $containername2
isula start
$containername2
fn_check_eq
"
$?
"
"0"
"start failed"
testcontainer
$containername2
running
# ps containers
cut_output_lines isula ps
-a
if
[[
"
${
lines
[1]
}
"
!=
*
"Up"
*
"
$containername2
"
*
]]
;
then
echo
"test failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[2]
}
"
!=
*
"Created"
*
]]
;
then
echo
"test failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[3]
}
"
!=
*
"Created"
*
]]
;
then
echo
"test failed"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
isula stop
$containername2
fn_check_eq
"
$?
"
"0"
"stop failed"
isula
rm
$containername
$containername2
$containername3
fn_check_eq
"
$?
"
"0"
"rm failed"
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic ps"
CI/test_cases/container_cases/restart.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance restart
# concurrent: YES
# spend time: 22
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
do_test_t
()
{
containername
=
test_restart
isula run
--name
$containername
-td
busybox
fn_check_eq
"
$?
"
"0"
"run failed"
testcontainer
$containername
running
isula restart
$containername
fn_check_eq
"
$?
"
"0"
"restart failed"
testcontainer
$containername
running
isula stop
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic restart"
CI/test_cases/container_cases/restartpolicy.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance restartpolicy
# concurrent: NO
# spend time: 25
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
do_test_on_failure
()
{
containername
=
test_rp_on_failure
isula run
--name
$containername
-td
--restart
on-failure:3 busybox /bin/sh
-c
"exit 2"
fn_check_eq
"
$?
"
"0"
"run failed"
sleep
6
count
=
`
isula inspect
--format
=
'{{json .RestartCount}}'
$containername
`
if
[[
$count
!=
"3"
]]
;
then
echo
"expect 3 but get
$count
"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
testcontainer
$containername
exited
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
}
function
do_test_always_cancel
()
{
containername
=
test_rp_always_cancel
isula run
--name
$containername
-td
--restart
always busybox
testcontainer
$containername
running
cpid
=
`
isula inspect
-f
'{{json .State.Pid}}'
$containername
`
kill
-9
$cpid
sleep
6
testcontainer
$containername
running
isula stop
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
}
function
do_test_t
()
{
do_test_on_failure
do_test_always_cancel
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic restartpolicy"
CI/test_cases/container_cases/resume.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance resume
# concurrent: YES
# spend time: 1
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
do_test_t
()
{
echo
"Do not support resume function now"
return
0
containername
=
test_resume
isula create
-t
--name
$containername
busybox
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername
inited
isula resume
$containername
fn_check_ne
"
$?
"
"0"
"resume should fail"
testcontainer
$containername
inited
isula start
$containername
fn_check_eq
"
$?
"
"0"
"start failed"
testcontainer
$containername
running
isula pause
$containername
fn_check_eq
"
$?
"
"0"
"pause failed"
testcontainer
$containername
paused
isula resume
$containername
fn_check_eq
"
$?
"
"0"
"resume failed"
testcontainer
$containername
running
isula
rm
-f
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic resume"
CI/test_cases/container_cases/rm.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance rm
# concurrent: YES
# spend time: 14
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
rm_stopped_container
()
{
containername
=
test_rm_stopped
isula create
-t
--name
$containername
busybox
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername
inited
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
isula inspect
$containername
fn_check_ne
"
$?
"
"0"
"inspect should fail"
}
function
rm_running_container
()
{
containername
=
test_rm_running
isula run
-td
--name
$containername
busybox
fn_check_eq
"
$?
"
"0"
"run failed"
testcontainer
$containername
running
isula
rm
$containername
fn_check_ne
"
$?
"
"0"
"rm should fail"
isula stop
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
isula inspect
$containername
fn_check_ne
"
$?
"
"0"
"inspect should fail"
}
function
rm_running_container_force
()
{
containername
=
test_rm_running_force
isula run
-td
--name
$containername
busybox
fn_check_eq
"
$?
"
"0"
"run failed"
testcontainer
$containername
running
isula
rm
--force
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
isula inspect
$containername
fn_check_ne
"
$?
"
"0"
"inspect should fail"
}
function
do_test_t
()
{
rm_stopped_container
rm_running_container
rm_running_container_force
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic rm"
CI/test_cases/container_cases/run.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance run
# concurrent: YES
# spend time: 12
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
do_test_t
()
{
containername
=
test_basic_run
isula run
--name
$containername
-td
busybox
fn_check_eq
"
$?
"
"0"
"run failed"
testcontainer
$containername
running
isula stop
-t
0
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
isula run
--name
$containername
-td
-v
/dev/shm:/dev/shm busybox
fn_check_eq
"
$?
"
"0"
"run failed"
testcontainer
$containername
running
isula stop
-t
0
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic run"
CI/test_cases/container_cases/share_ns_test.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad share namepaces
# concurrent: NO
# spend time: 6
#######################################################################
##- @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-04-24
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
arr_ns_type[0]
=
"--ipc"
arr_ns_type[1]
=
"--pid"
arr_ns_type[2]
=
"--net"
arr_ns_type[3]
=
"--uts"
function
do_test_t
()
{
for
((
i
=
0
;
i <
${#
arr_ns_type
[*]
}
;
i++
))
do
echo
${
arr_ns_type
[
$i
]
}
cid[
$i
]=
`
isula create
-ti
busybox /bin/sh
`
fn_check_eq
"
$?
"
"0"
"create
${
cid
[
$i
]
}
"
msg
=
`
isula run
-tid
${
arr_ns_type
[
$i
]
}
=
"container:
${
cid
[
$i
]
}
"
busybox /bin/sh 2>&1
`
echo
$msg
|
grep
"Can not join namespace of a non running container"
fn_check_eq
"
$?
"
"0"
"share ipc fail test"
isula
rm
-f
${
cid
[
$i
]
}
rid[
$i
]=
`
isula run
-tid
busybox /bin/sh
`
fn_check_eq
"
$?
"
"0"
"run
${
rid
[
$i
]
}
"
id
=
`
isula run
-tid
busybox /bin/sh
`
fn_check_eq
"
$?
"
"0"
"run
$id
"
test_id
=
`
isula run
-tid
${
arr_ns_type
[
$i
]
}
=
"container:
$id
"
busybox /bin/sh
`
fn_check_eq
"
$?
"
"0"
"share
${
arr_ns_type
[
$i
]
}
success test"
isula restart
--time
=
0
$id
fn_check_eq
"
$?
"
"0"
"restart container
$id
"
testcontainer
$id
running
isula restart
--time
=
0
${
test_id
}
fn_check_eq
"
$?
"
"0"
"restart container
${
test_id
}
"
testcontainer
${
test_id
}
running
isula
rm
-f
${
test_id
}
$id
done
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic share ns test"
CI/test_cases/container_cases/start.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
do_test_t
()
{
containername
=
test_start
isula create
-t
--name
$containername
busybox
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername
inited
isula start
$containername
fn_check_eq
"
$?
"
"0"
"start failed"
testcontainer
$containername
running
isula stop
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic start"
CI/test_cases/container_cases/stop.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance stop
# concurrent: YES
# spend time: 24
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
do_test_t
()
{
containername
=
test_stop
isula run
--name
$containername
-td
busybox
fn_check_eq
"
$?
"
"0"
"run failed"
testcontainer
$containername
running
isula stop
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
isula start
$containername
fn_check_eq
"
$?
"
"0"
"start failed"
testcontainer
$containername
running
isula stop
--force
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
isula start
$containername
fn_check_eq
"
$?
"
"0"
"start failed"
testcontainer
$containername
running
isula stop
--time
10
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
isula start
$containername
fn_check_eq
"
$?
"
"0"
"start failed"
testcontainer
$containername
running
isula stop
--time
10
--force
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
isula
rm
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic stop"
CI/test_cases/container_cases/update.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance update
# concurrent: YES
# spend time: 17
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
do_test_t
()
{
containername
=
test_update
containerid
=
`
isula create
-t
--name
$containername
busybox
`
fn_check_eq
"
$?
"
"0"
"create failed"
testcontainer
$containername
inited
isula start
$containername
fn_check_eq
"
$?
"
"0"
"start failed"
testcontainer
$containername
running
isula update
--kernel-memory
1000000000
$containername
fn_check_ne
"
$?
"
"0"
"update should fail"
isula update
--cpu-shares
1024
$containername
fn_check_eq
"
$?
"
"0"
"update failed"
tmp
=
`
isula
exec
$containername
cat
/sys/fs/cgroup/cpu/cpu.shares
`
if
[
$tmp
!=
"1024"
]
;
then
echo
"Failed to check running cpu shares"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
isula update
--cpu-period
100000
$containername
fn_check_eq
"
$?
"
"0"
"update failed"
tmp
=
`
isula
exec
$containername
cat
/sys/fs/cgroup/cpu/cpu.cfs_period_us
`
if
[
$tmp
!=
"100000"
]
;
then
echo
"Failed to check running cpu period"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
isula update
--cpu-quota
50000
$containername
fn_check_eq
"
$?
"
"0"
"update failed"
tmp
=
`
isula
exec
$containername
cat
/sys/fs/cgroup/cpu/cpu.cfs_quota_us
`
if
[
$tmp
!=
"50000"
]
;
then
echo
"Failed to check running cpu quota"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
isula update
--cpuset-cpus
0-1
$containername
fn_check_eq
"
$?
"
"0"
"update failed"
tmp
=
`
isula
exec
$containername
cat
/sys/fs/cgroup/cpuset/cpuset.cpus
`
if
[
$tmp
!=
"0-1"
]
;
then
echo
"Failed to check running cpu set"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
isula update
--cpuset-mems
0
$containername
fn_check_eq
"
$?
"
"0"
"update failed"
tmp
=
`
isula
exec
$containername
cat
/sys/fs/cgroup/cpuset/cpuset.mems
`
if
[
$tmp
!=
"0"
]
;
then
echo
"Failed to check running cpu set mems"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
isula update
--memory
1000000000
$containername
fn_check_eq
"
$?
"
"0"
"update failed"
tmp
=
`
isula
exec
$containername
cat
/sys/fs/cgroup/memory/memory.limit_in_bytes
`
value
=
$((
$tmp
-
1000000000
))
if
[[
$value
-lt
-10000
||
$value
-gt
10000
]]
;
then
echo
"Failed to check running memory"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
isula update
--memory-reservation
100000000
$containername
fn_check_eq
"
$?
"
"0"
"update failed"
tmp
=
`
isula
exec
$containername
cat
/sys/fs/cgroup/memory/memory.soft_limit_in_bytes
`
value
=
$((
$tmp
-
100000000
))
if
[[
$value
-lt
-10000
||
$value
-gt
10000
]]
;
then
echo
"Failed to check running reservation memory"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
isula stop
$containername
fn_check_eq
"
$?
"
"0"
"stop failed"
testcontainer
$containername
exited
isula update
--kernel-memory
2000000000
$containername
fn_check_eq
"
$?
"
"0"
"update failed"
isula start
$containername
fn_check_eq
"
$?
"
"0"
"start failed"
tmp
=
`
isula
exec
$containername
cat
/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes
`
value
=
$((
$tmp
-
2000000000
))
if
[[
$value
-lt
-10000
||
$value
-gt
10000
]]
;
then
echo
"Failed to check running reservation memory"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
isula
rm
-f
$containername
fn_check_eq
"
$?
"
"0"
"rm failed"
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic update"
CI/test_cases/container_cases/version.bash
0 → 100755
浏览文件 @
2b7c40b9
#!/bin/bash
#
# attributes: isulad inheritance version
# concurrent: YES
# spend time: 1
#######################################################################
##- @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: lifeng
##- @Create: 2020-03-30
#######################################################################
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
../helpers.bash
function
isulad_version
()
{
cut_output_lines isulad
--version
fn_check_eq
"
$?
"
"0"
"check failed"
if
!
[[
${
lines
[0]
}
=
~ Version
\
[
0-9]+
\.
[
0-9]+
\.
[
0-9]+,
\
commit
]]
;
then
echo
"isulad version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
}
function
isula_version
()
{
cut_output_lines isula
--version
fn_check_eq
"
$?
"
"0"
"check failed"
if
![[
${
lines
[0]
}
=
~ Version
\
[
0-9]+
\.
[
0-9]+
\.
[
0-9]+,
\
commit
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
cut_output_lines isula version
fn_check_eq
"
$?
"
"0"
"check failed"
if
[[
"
${
lines
[0]
}
"
!=
"Client:"
*
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[1]
}
"
!=
" Version:"
*
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[2]
}
"
!=
" Git commit:"
*
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[3]
}
"
!=
" Built:"
*
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[4]
}
"
!=
"Server:"
*
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[5]
}
"
!=
" Version:"
*
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[6]
}
"
!=
" Git commit:"
*
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[7]
}
"
!=
" Built:"
*
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[8]
}
"
!=
"OCI config:"
*
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[9]
}
"
!=
" Version:"
*
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
if
[[
"
${
lines
[10]
}
"
!=
" Default file:"
*
]]
;
then
echo
"isula version error"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
}
function
do_test_t
()
{
isula_version
isulad_version
return
$TC_RET_T
}
ret
=
0
do_test_t
if
[
$?
-ne
0
]
;
then
let
"ret=
$ret
+ 1"
fi
show_result
$ret
"basic version"
src/image/oci/oci_common_operators.c
浏览文件 @
2b7c40b9
...
...
@@ -579,6 +579,7 @@ int oci_image_conf_merge_into_spec(const char *image_name, container_config *con
out:
free
(
resolved_name
);
free_imagetool_image
(
image_info
);
return
ret
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录