Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
5534d384
M
milvus
项目概览
milvus
/
milvus
11 个月 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
5534d384
编写于
2月 23, 2023
作者:
Z
zhuwenxing
提交者:
GitHub
2月 23, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[test] Fix chaos duration is not updated and add target number option (#22346)
Signed-off-by:
N
zhuwenxing
<
wenxing.zhu@zilliz.com
>
上级
bddda5bd
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
11 addition
and
3 deletion
+11
-3
tests/python_client/chaos/conftest.py
tests/python_client/chaos/conftest.py
+6
-0
tests/python_client/chaos/test_chaos_apply.py
tests/python_client/chaos/test_chaos_apply.py
+3
-1
tests/python_client/common/cus_resource_opts.py
tests/python_client/common/cus_resource_opts.py
+2
-2
未找到文件。
tests/python_client/chaos/conftest.py
浏览文件 @
5534d384
...
@@ -4,6 +4,7 @@ import pytest
...
@@ -4,6 +4,7 @@ import pytest
def
pytest_addoption
(
parser
):
def
pytest_addoption
(
parser
):
parser
.
addoption
(
"--chaos_type"
,
action
=
"store"
,
default
=
"pod_kill"
,
help
=
"chaos_type"
)
parser
.
addoption
(
"--chaos_type"
,
action
=
"store"
,
default
=
"pod_kill"
,
help
=
"chaos_type"
)
parser
.
addoption
(
"--target_component"
,
action
=
"store"
,
default
=
"querynode"
,
help
=
"target_component"
)
parser
.
addoption
(
"--target_component"
,
action
=
"store"
,
default
=
"querynode"
,
help
=
"target_component"
)
parser
.
addoption
(
"--target_number"
,
action
=
"store"
,
default
=
"1"
,
help
=
"target_number"
)
parser
.
addoption
(
"--chaos_duration"
,
action
=
"store"
,
default
=
"1m"
,
help
=
"chaos_duration"
)
parser
.
addoption
(
"--chaos_duration"
,
action
=
"store"
,
default
=
"1m"
,
help
=
"chaos_duration"
)
parser
.
addoption
(
"--chaos_interval"
,
action
=
"store"
,
default
=
"10s"
,
help
=
"chaos_interval"
)
parser
.
addoption
(
"--chaos_interval"
,
action
=
"store"
,
default
=
"10s"
,
help
=
"chaos_interval"
)
parser
.
addoption
(
"--request_duration"
,
action
=
"store"
,
default
=
"3m"
,
help
=
"request_duration"
)
parser
.
addoption
(
"--request_duration"
,
action
=
"store"
,
default
=
"3m"
,
help
=
"request_duration"
)
...
@@ -20,6 +21,11 @@ def target_component(request):
...
@@ -20,6 +21,11 @@ def target_component(request):
return
request
.
config
.
getoption
(
"--target_component"
)
return
request
.
config
.
getoption
(
"--target_component"
)
@
pytest
.
fixture
def
target_number
(
request
):
return
request
.
config
.
getoption
(
"--target_number"
)
@
pytest
.
fixture
@
pytest
.
fixture
def
chaos_duration
(
request
):
def
chaos_duration
(
request
):
return
request
.
config
.
getoption
(
"--chaos_duration"
)
return
request
.
config
.
getoption
(
"--chaos_duration"
)
...
...
tests/python_client/chaos/test_chaos_apply.py
浏览文件 @
5534d384
...
@@ -54,7 +54,7 @@ class TestChaosApply:
...
@@ -54,7 +54,7 @@ class TestChaosApply:
chaos_res
.
delete
(
meta_name
,
raise_ex
=
False
)
chaos_res
.
delete
(
meta_name
,
raise_ex
=
False
)
sleep
(
2
)
sleep
(
2
)
def
test_chaos_apply
(
self
,
chaos_type
,
target_component
,
chaos_duration
,
chaos_interval
):
def
test_chaos_apply
(
self
,
chaos_type
,
target_component
,
target_number
,
chaos_duration
,
chaos_interval
):
# start the monitor threads to check the milvus ops
# start the monitor threads to check the milvus ops
log
.
info
(
"*********************Chaos Test Start**********************"
)
log
.
info
(
"*********************Chaos Test Start**********************"
)
log
.
info
(
connections
.
get_connection_addr
(
'default'
))
log
.
info
(
connections
.
get_connection_addr
(
'default'
))
...
@@ -67,6 +67,7 @@ class TestChaosApply:
...
@@ -67,6 +67,7 @@ class TestChaosApply:
update_key_value
(
chaos_config
,
"release"
,
release_name
)
update_key_value
(
chaos_config
,
"release"
,
release_name
)
update_key_value
(
chaos_config
,
"app.kubernetes.io/instance"
,
release_name
)
update_key_value
(
chaos_config
,
"app.kubernetes.io/instance"
,
release_name
)
update_key_value
(
chaos_config
,
"namespaces"
,
[
self
.
milvus_ns
])
update_key_value
(
chaos_config
,
"namespaces"
,
[
self
.
milvus_ns
])
update_key_value
(
chaos_config
,
"value"
,
target_number
)
self
.
chaos_config
=
chaos_config
self
.
chaos_config
=
chaos_config
if
"s"
in
chaos_interval
:
if
"s"
in
chaos_interval
:
schedule
=
f
"*/
{
chaos_interval
[:
-
1
]
}
* * * * *"
schedule
=
f
"*/
{
chaos_interval
[:
-
1
]
}
* * * * *"
...
@@ -76,6 +77,7 @@ class TestChaosApply:
...
@@ -76,6 +77,7 @@ class TestChaosApply:
# update chaos_duration from string to int with unit second
# update chaos_duration from string to int with unit second
chaos_duration
=
chaos_duration
.
replace
(
'h'
,
'*3600+'
).
replace
(
'm'
,
'*60+'
).
replace
(
's'
,
'*1+'
)
+
'+0'
chaos_duration
=
chaos_duration
.
replace
(
'h'
,
'*3600+'
).
replace
(
'm'
,
'*60+'
).
replace
(
's'
,
'*1+'
)
+
'+0'
chaos_duration
=
eval
(
chaos_duration
)
chaos_duration
=
eval
(
chaos_duration
)
update_key_value
(
chaos_config
,
"duration"
,
f
"
{
chaos_duration
//
60
}
m"
)
if
self
.
deploy_by
==
"milvus-operator"
:
if
self
.
deploy_by
==
"milvus-operator"
:
update_key_name
(
chaos_config
,
"component"
,
"app.kubernetes.io/component"
)
update_key_name
(
chaos_config
,
"component"
,
"app.kubernetes.io/component"
)
self
.
_chaos_config
=
chaos_config
# cache the chaos config for tear down
self
.
_chaos_config
=
chaos_config
# cache the chaos config for tear down
...
...
tests/python_client/common/cus_resource_opts.py
浏览文件 @
5534d384
...
@@ -37,7 +37,7 @@ class CustomResourceOperations(object):
...
@@ -37,7 +37,7 @@ class CustomResourceOperations(object):
try
:
try
:
api_response
=
api_instance
.
create_namespaced_custom_object
(
self
.
group
,
self
.
version
,
self
.
namespace
,
api_response
=
api_instance
.
create_namespaced_custom_object
(
self
.
group
,
self
.
version
,
self
.
namespace
,
plural
=
self
.
plural
,
body
=
body
,
pretty
=
pretty
)
plural
=
self
.
plural
,
body
=
body
,
pretty
=
pretty
)
log
.
debug
(
f
"create custom resource response:
{
api_response
}
"
)
log
.
info
(
f
"create custom resource response:
{
api_response
}
"
)
except
ApiException
as
e
:
except
ApiException
as
e
:
log
.
error
(
"Exception when calling CustomObjectsApi->create_namespaced_custom_object: %s
\n
"
%
e
)
log
.
error
(
"Exception when calling CustomObjectsApi->create_namespaced_custom_object: %s
\n
"
%
e
)
raise
Exception
(
str
(
e
))
raise
Exception
(
str
(
e
))
...
@@ -51,7 +51,7 @@ class CustomResourceOperations(object):
...
@@ -51,7 +51,7 @@ class CustomResourceOperations(object):
api_response
=
api_instance
.
delete_namespaced_custom_object
(
self
.
group
,
self
.
version
,
self
.
namespace
,
api_response
=
api_instance
.
delete_namespaced_custom_object
(
self
.
group
,
self
.
version
,
self
.
namespace
,
self
.
plural
,
self
.
plural
,
metadata_name
)
metadata_name
)
log
.
debug
(
f
"delete custom resource response:
{
api_response
}
"
)
log
.
info
(
f
"delete custom resource response:
{
api_response
}
"
)
except
ApiException
as
e
:
except
ApiException
as
e
:
if
raise_ex
:
if
raise_ex
:
log
.
error
(
"Exception when calling CustomObjectsApi->delete_namespaced_custom_object: %s
\n
"
%
e
)
log
.
error
(
"Exception when calling CustomObjectsApi->delete_namespaced_custom_object: %s
\n
"
%
e
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录