Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
0d400389
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,发现更多精彩内容 >>
提交
0d400389
编写于
5月 19, 2020
作者:
L
lifeng68
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CI: refact CI testcases
Signed-off-by:
N
lifeng68
<
lifeng68@huawei.com
>
上级
d82700f3
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
69 addition
and
277 deletion
+69
-277
CI/test_cases/basic_cases/basic_helpers.bash
CI/test_cases/basic_cases/basic_helpers.bash
+0
-84
CI/test_cases/basic_cases/create_mtab_test.bash
CI/test_cases/basic_cases/create_mtab_test.bash
+0
-48
CI/test_cases/helpers.bash
CI/test_cases/helpers.bash
+60
-136
CI/test_cases/image_cases/help.bash
CI/test_cases/image_cases/help.bash
+1
-1
CI/test_cases/image_cases/image_inspect.bash
CI/test_cases/image_cases/image_inspect.bash
+1
-1
CI/test_cases/image_cases/image_remove.bash
CI/test_cases/image_cases/image_remove.bash
+1
-1
CI/test_cases/image_cases/image_tag.bash
CI/test_cases/image_cases/image_tag.bash
+1
-1
CI/test_cases/image_cases/images_list.bash
CI/test_cases/image_cases/images_list.bash
+1
-1
CI/test_cases/image_cases/img_fs_info.bash
CI/test_cases/image_cases/img_fs_info.bash
+1
-1
CI/test_cases/image_cases/img_status.bash
CI/test_cases/image_cases/img_status.bash
+1
-1
CI/test_cases/image_cases/registry.bash
CI/test_cases/image_cases/registry.bash
+1
-1
CI/test_cases/image_cases/version.bash
CI/test_cases/image_cases/version.bash
+1
-1
未找到文件。
CI/test_cases/basic_cases/basic_helpers.bash
已删除
100755 → 0
浏览文件 @
d82700f3
#!/bin/bash
#######################################################################
##- @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
#######################################################################
# testcase result
TC_RET_T
=
0
declare
-a
lines
# Root directory of integration tests.
INTEGRATION_ROOT
=
$(
dirname
"
$(
readlink
-f
"
$BASH_SOURCE
"
)
"
)
LCR_ROOT_PATH
=
"/var/lib/isulad/engines/lcr"
ISUALD_LOG
=
"/var/lib/isulad/isulad.log"
declare
-r
-i
FAILURE
=
-1
function
cut_output_lines
()
{
message
=
`
$@
2>&1
`
retval
=
$?
oldifs
=
${
IFS
}
IFS
=
$'
\n
'
lines
=(
${
message
}
)
IFS
=
"
${
oldifs
}
"
return
$retval
}
function
fn_check_eq
()
{
if
[[
"
$1
"
-ne
"
$2
"
]]
;
then
echo
"
$3
"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
}
function
fn_check_ne
()
{
if
[[
"
$1
"
-eq
"
$2
"
]]
;
then
echo
"
$3
"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
}
function
testcontainer
()
{
st
=
`
isula inspect
-f
'{{json .State.Status}}'
"
$1
"
`
if
!
[[
"
${
st
}
"
=
~
"
$2
"
]]
;
then
echo
"expect status
$2
, but get
${
st
}
"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
}
function
crictl
()
{
CRICTL
=
$(
which crictl
)
"
$CRICTL
"
-i
unix:///var/run/isulad.sock
-r
unix:///var/run/isulad.sock
"
$@
"
}
function
msg_ok
()
{
echo
-e
"[
$(
date
+
'%Y-%m-%dT%H:%M:%S%z'
)
]:
\0
33[1;32m
$@
\0
33[0m"
}
function
msg_err
()
{
echo
-e
"[
$(
date
+
'%Y-%m-%dT%H:%M:%S%z'
)
]:
\0
33[1;31m
$@
\0
33[0m"
>
&2
}
function
msg_info
()
{
echo
"[
$(
date
+
'%Y-%m-%dT%H:%M:%S%z'
)
]:
$@
"
}
function
show_result
()
{
[[
${
1
}
-ne
0
]]
&&
msg_err
"TESTSUIT:
$2
FAILED"
&&
return
${
FAILURE
}
msg_ok
"TESTSUIT:
$2
SUCCESS"
}
CI/test_cases/basic_cases/create_mtab_test.bash
已删除
100755 → 0
浏览文件 @
d82700f3
#!/bin/bash
#
# attributes: isulad inheritance start
# concurrent: YES
# spend time: 2
#######################################################################
##- @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/helpers.bash
浏览文件 @
0d400389
#!/bin/bash
set
-x
CRICTL
=
$(
which crictl
)
#######################################################################
##- @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
#######################################################################
# testcase result
TC_RET_T
=
0
declare
-a
lines
#
image to pull and run container
BUSYBOX_IMAGE
=
"busybox:latest
"
#
Root directory of integration tests.
LCR_ROOT_PATH
=
"/var/lib/isulad/engines/lcr
"
valgrind_log
=
"/tmp/valgrind.log"
ISUALD_LOG
=
"/var/lib/isulad/isulad.log"
ISULAD_ROOT_DIR
=
"/var/lib/isulad"
ISULAD_LCR_ENGINE_DIR
=
"
$ISULAD_ROOT_DIR
/engines/lcr"
kubeAPIVersion
=
"0.1.0"
iSulaRuntimeName
=
"iSulad"
RuntimeVersion
=
"2.0"
RuntimeAPIVersion
=
"1.0"
Logging_Driver
=
"json-file"
Cgroup_Driver
=
"cgroupfs"
# ===================================================
function
echo_text
()
{
local
TXT
=
$1
local
COLOR
=
$2
if
[
"
${
COLOR
}
"
=
"red"
]
;
then
echo
-e
"
\e
[1;31m
${
TXT
}
\e
[0m"
elif
[
"
${
COLOR
}
"
=
"green"
]
;
then
echo
-e
"
\e
[1;32m
${
TXT
}
\e
[0m"
elif
[
"
${
COLOR
}
"
=
"yellow"
]
;
then
echo
-e
"
\e
[1;33m
${
TXT
}
\e
[0m"
else
echo
${
TXT
}
declare
-r
-i
FAILURE
=
-1
function
cut_output_lines
()
{
message
=
`
$@
2>&1
`
retval
=
$?
oldifs
=
${
IFS
}
IFS
=
$'
\n
'
lines
=(
${
message
}
)
IFS
=
"
${
oldifs
}
"
return
$retval
}
function
fn_check_eq
()
{
if
[[
"
$1
"
-ne
"
$2
"
]]
;
then
echo
"
$3
"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
}
function
ERROR
()
{
txt_str
=
$1
echo_text
"
$txt_str
"
red
function
fn_check_ne
()
{
if
[[
"
$1
"
-eq
"
$2
"
]]
;
then
echo
"
$3
"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
}
function
INFO
()
{
txt_str
=
$1
echo_text
"
$txt_str
"
green
function
testcontainer
()
{
st
=
`
isula inspect
-f
'{{json .State.Status}}'
"
$1
"
`
if
!
[[
"
${
st
}
"
=
~
"
$2
"
]]
;
then
echo
"expect status
$2
, but get
${
st
}
"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
}
function
DEBUG
()
{
txt_str
=
$1
echo_text
"
$txt_str
"
yellow
function
crictl
()
{
CRICTL
=
$(
which crictl
)
"
$CRICTL
"
-i
unix:///var/run/isulad.sock
-r
unix:///var/run/isulad.sock
"
$@
"
}
# ===============================================
function
is_new_oci_image
()
{
ps aux |
grep
"isulad_kit"
|
grep
"isula_image
\.
sock"
>
/dev/null 2>&1
if
[
$?
-ne
0
]
;
then
DEBUG
"Current use old oci image mechanism, Skip this testcase......"
exit
0
fi
function
msg_ok
()
{
echo
-e
"[
$(
date
+
'%Y-%m-%dT%H:%M:%S%z'
)
]:
\0
33[1;32m
$@
\0
33[0m"
}
function
check_fn_return
()
{
if
[[
"
$1
"
!=
"
$2
"
]]
;
then
ERROR
"[
`
date
`
] Expect '
$1
' but got '
$2
': FAILED (
$3
)"
((
TC_RET_T++
))
else
INFO
"[
`
date
`
] Expect '
$1
' and got '
$2
': SUCCESS (
$3
)"
fi
function
msg_err
()
{
echo
-e
"[
$(
date
+
'%Y-%m-%dT%H:%M:%S%z'
)
]:
\0
33[1;31m
$@
\0
33[0m"
>
&2
}
function
check_fn_return_noskip
()
{
if
[[
"
$1
"
!=
"
$2
"
]]
;
then
ERROR
"[
`
date
`
] Expect '
$1
' but got '
$2
': FAILED (
$3
)"
exit
1
else
INFO
"[
`
date
`
] Expect '
$1
' and got '
$2
': SUCCESS (
$3
)"
fi
function
msg_info
()
{
echo
"[
$(
date
+
'%Y-%m-%dT%H:%M:%S%z'
)
]:
$@
"
}
function
isulad_is_running
()
{
local
ret
=
1
for
i
in
`
seq
3
`
;
do
isula version
if
[
$?
-eq
0
]
;
then
ret
=
0
break
fi
sleep
1
done
return
${
ret
}
function
show_result
()
{
[[
${
1
}
-ne
0
]]
&&
msg_err
"TESTSUIT:
$2
FAILED"
&&
return
${
FAILURE
}
msg_ok
"TESTSUIT:
$2
SUCCESS"
}
function
wait_isulad_running
()
{
...
...
@@ -156,57 +144,6 @@ function check_valgrind_log() {
return
0
}
# Wrapper for crictl
function
crictl
()
{
"
$CRICTL
"
-i
unix:///var/run/isulad.sock
-r
unix:///var/run/isulad.sock
"
$@
"
}
function
get_cgroup_real_path
()
{
cat
/proc/1/cgroup |
head
-n
1 |
awk
-F
':'
'{print $3}'
}
function
get_container_interface_ip_by_pid
()
{
if
[
$#
-ne
2
]
;
then
return
""
fi
nsenter
-t
$1
-n
ifconfig
$2
|
grep
'inet '
|
sed
's/netmask.*//g'
|
grep
-Eoe
"(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])
\.
){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])"
}
function
set_ip_for_cni_bridge
()
{
if
[
$#
-ne
2
]
;
then
echo
"set_ip_for_cni_bridge: invalid arguments, usage: set_ip_for_cni_bridge cni0 10.1.0.1"
return
1
fi
ifconfig
$1
$2
}
function
show_result
()
{
if
[
$1
-ne
0
]
;
then
echo
"TESTSUIT:
$2
FAILED"
return
1
fi
echo
"TESTSUIT:
$2
SUCCESS"
}
function
msleep
()
{
if
[
$#
-ne
1
]
;
then
echo
"use default sleep"
sleep
$@
return
fi
sec
=
$1
env
|
grep
GCOV
if
[
$?
-eq
0
]
;
then
((
sec
=
$sec
+2
))
fi
sleep
$sec
}
function
err
()
{
echo
"[
$(
date
+
'%Y-%m-%dT%H:%M:%S%z'
)
]:
$@
"
>
&2
}
function
init_cni_conf
()
{
dtpath
=
"
$1
"
...
...
@@ -230,16 +167,3 @@ function init_cni_conf()
return
$TC_RET_T
}
function
wait_container_state
()
{
while
true
do
isula inspect
-f
'{{json .State.Status}}'
"
$1
"
|
grep
"
$2
"
if
[
$?
-eq
0
]
;
then
return
;
fi
sleep
1
done
}
CI/test_cases/
basic
_cases/help.bash
→
CI/test_cases/
image
_cases/help.bash
浏览文件 @
0d400389
...
...
@@ -21,7 +21,7 @@
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
.
/basic_
helpers.bash
source
.
./
helpers.bash
function
isulad_help
()
{
...
...
CI/test_cases/
basic
_cases/image_inspect.bash
→
CI/test_cases/
image
_cases/image_inspect.bash
浏览文件 @
0d400389
...
...
@@ -20,7 +20,7 @@
#######################################################################
declare
-r
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
source
${
curr_path
}
/basic_
helpers.bash
source
../
helpers.bash
function
test_image_info
()
{
...
...
CI/test_cases/
basic
_cases/image_remove.bash
→
CI/test_cases/
image
_cases/image_remove.bash
浏览文件 @
0d400389
...
...
@@ -6,7 +6,7 @@
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
.
/basic_
helpers.bash
source
.
./
helpers.bash
do_test_t
()
{
...
...
CI/test_cases/
basic
_cases/image_tag.bash
→
CI/test_cases/
image
_cases/image_tag.bash
浏览文件 @
0d400389
...
...
@@ -20,7 +20,7 @@
#######################################################################
declare
-r
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
source
${
curr_path
}
/basic_
helpers.bash
source
../
helpers.bash
image_busybox
=
"busybox"
image_ubuntu
=
"ubuntu"
...
...
CI/test_cases/
basic
_cases/images_list.bash
→
CI/test_cases/
image
_cases/images_list.bash
浏览文件 @
0d400389
...
...
@@ -20,7 +20,7 @@
#######################################################################
declare
-r
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
source
${
curr_path
}
/basic_
helpers.bash
source
../
helpers.bash
function
test_image_list
()
{
...
...
CI/test_cases/
basic
_cases/img_fs_info.bash
→
CI/test_cases/
image
_cases/img_fs_info.bash
浏览文件 @
0d400389
...
...
@@ -20,7 +20,7 @@
#######################################################################
declare
-r
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
source
${
curr_path
}
/basic_
helpers.bash
source
../
helpers.bash
function
test_crictl_image
()
{
...
...
CI/test_cases/
basic
_cases/img_status.bash
→
CI/test_cases/
image
_cases/img_status.bash
浏览文件 @
0d400389
...
...
@@ -22,7 +22,7 @@
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
driver
=
"overlay2"
source
.
/basic_
helpers.bash
source
.
./
helpers.bash
function
pre_test
()
{
...
...
CI/test_cases/
basic
_cases/registry.bash
→
CI/test_cases/
image
_cases/registry.bash
浏览文件 @
0d400389
...
...
@@ -21,7 +21,7 @@
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
.
/basic_
helpers.bash
source
.
./
helpers.bash
function
isula_pull
()
{
...
...
CI/test_cases/
basic
_cases/version.bash
→
CI/test_cases/
image
_cases/version.bash
浏览文件 @
0d400389
...
...
@@ -21,7 +21,7 @@
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/../data
)
source
.
/basic_
helpers.bash
source
.
./
helpers.bash
function
isulad_version
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录