Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
b2a2ef18
M
milvus
项目概览
milvus
/
milvus
10 个月 前同步成功
通知
260
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
b2a2ef18
编写于
1月 14, 2022
作者:
X
XuanYang-cn
提交者:
GitHub
1月 14, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update pymilvus version to 2.0.0rc10.dev5 (#15197)
Signed-off-by:
N
yangxuan
<
xuan.yang@zilliz.com
>
上级
cc5bee46
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
50 addition
and
41 deletion
+50
-41
tests/python_client/base/client_base.py
tests/python_client/base/client_base.py
+6
-5
tests/python_client/base/collection_wrapper.py
tests/python_client/base/collection_wrapper.py
+2
-0
tests/python_client/base/connections_wrapper.py
tests/python_client/base/connections_wrapper.py
+9
-3
tests/python_client/check/func_check.py
tests/python_client/check/func_check.py
+6
-5
tests/python_client/common/common_type.py
tests/python_client/common/common_type.py
+1
-1
tests/python_client/requirements.txt
tests/python_client/requirements.txt
+2
-2
tests/python_client/testcases/test_collection.py
tests/python_client/testcases/test_collection.py
+6
-4
tests/python_client/testcases/test_connection.py
tests/python_client/testcases/test_connection.py
+16
-19
tests/python_client/testcases/test_delete.py
tests/python_client/testcases/test_delete.py
+0
-1
tests/python_client/testcases/test_index.py
tests/python_client/testcases/test_index.py
+2
-1
未找到文件。
tests/python_client/base/client_base.py
浏览文件 @
b2a2ef18
...
...
@@ -64,7 +64,7 @@ class Base:
try
:
""" Drop collection before disconnect """
if
self
.
connection_wrap
.
get_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
)[
0
]
is
None
:
if
not
self
.
connection_wrap
.
has_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
)[
0
]
:
self
.
connection_wrap
.
connect
(
alias
=
DefaultConfig
.
DEFAULT_USING
,
host
=
param_info
.
param_host
,
port
=
param_info
.
param_port
)
...
...
@@ -107,7 +107,7 @@ class TestcaseBase(Base):
def
init_collection_wrap
(
self
,
name
=
None
,
schema
=
None
,
shards_num
=
2
,
check_task
=
None
,
check_items
=
None
,
**
kwargs
):
name
=
cf
.
gen_unique_str
(
'coll_'
)
if
name
is
None
else
name
schema
=
cf
.
gen_default_collection_schema
()
if
schema
is
None
else
schema
if
self
.
connection_wrap
.
get_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
)[
0
]
is
None
:
if
not
self
.
connection_wrap
.
has_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
)[
0
]
:
self
.
_connect
()
collection_w
=
ApiCollectionWrapper
()
collection_w
.
init_collection
(
name
=
name
,
schema
=
schema
,
shards_num
=
shards_num
,
check_task
=
check_task
,
check_items
=
check_items
,
**
kwargs
)
...
...
@@ -185,7 +185,7 @@ class TestcaseBase(Base):
:param half: half of nb
:return: collection wrap and partition wrap
"""
conn
=
self
.
_connect
()
self
.
_connect
()
collection_w
=
self
.
init_collection_wrap
(
name
=
cf
.
gen_unique_str
(
prefix
))
partition_w
=
self
.
init_partition_wrap
(
collection_wrap
=
collection_w
)
# insert [0, half) into partition_w
...
...
@@ -194,7 +194,8 @@ class TestcaseBase(Base):
# insert [half, nb) into _default
df_default
=
cf
.
gen_default_dataframe_data
(
nb
=
half
,
start
=
half
)
collection_w
.
insert
(
df_default
)
conn
.
flush
([
collection_w
.
name
])
# flush
collection_w
.
num_entities
collection_w
.
load
(
partition_names
=
[
partition_w
.
name
,
"_default"
])
return
collection_w
,
partition_w
,
df_partition
,
df_default
...
...
tests/python_client/base/collection_wrapper.py
浏览文件 @
b2a2ef18
import
sys
import
time
from
pymilvus
import
Collection
...
...
@@ -120,6 +121,7 @@ class ApiCollectionWrapper:
def
query
(
self
,
expr
,
output_fields
=
None
,
partition_names
=
None
,
timeout
=
None
,
check_task
=
None
,
check_items
=
None
,
**
kwargs
):
time
.
sleep
(
5
)
timeout
=
TIMEOUT
if
timeout
is
None
else
timeout
func_name
=
sys
.
_getframe
().
f_code
.
co_name
...
...
tests/python_client/base/connections_wrapper.py
浏览文件 @
b2a2ef18
...
...
@@ -35,12 +35,18 @@ class ApiConnectionsWrapper:
check_result
=
ResponseChecker
(
response
,
func_name
,
check_task
,
check_items
,
succ
,
alias
=
alias
,
**
kwargs
).
run
()
return
response
,
check_result
def
get
_connection
(
self
,
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
None
,
check_items
=
None
):
def
has
_connection
(
self
,
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
None
,
check_items
=
None
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
response
,
is_succ
=
api_request
([
self
.
connection
.
get
_connection
,
alias
])
check_result
=
ResponseChecker
(
response
,
func_name
,
check_task
,
check_items
,
is_
succ
,
alias
=
alias
).
run
()
response
,
succ
=
api_request
([
self
.
connection
.
has
_connection
,
alias
])
check_result
=
ResponseChecker
(
response
,
func_name
,
check_task
,
check_items
,
succ
,
alias
=
alias
).
run
()
return
response
,
check_result
# def get_connection(self, alias=DefaultConfig.DEFAULT_USING, check_task=None, check_items=None):
# func_name = sys._getframe().f_code.co_name
# response, is_succ = api_request([self.connection.get_connection, alias])
# check_result = ResponseChecker(response, func_name, check_task, check_items, is_succ, alias=alias).run()
# return response, check_result
def
list_connections
(
self
,
check_task
=
None
,
check_items
=
None
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
response
,
is_succ
=
api_request
([
self
.
connection
.
list_connections
])
...
...
tests/python_client/check/func_check.py
浏览文件 @
b2a2ef18
...
...
@@ -108,12 +108,13 @@ class ResponseChecker:
if
func_name
==
"connect"
:
class_obj
=
Connect_Object_Name
res_obj
=
type
(
res
).
__name__
assert
res_obj
==
class_obj
#
res_obj = type(res).__name__
#
assert res_obj == class_obj
if
func_name
==
"get_connection"
:
value_content
=
params
.
get
(
ct
.
value_content
,
None
)
res_obj
=
type
(
res
).
__name__
if
res
is
not
None
else
None
if
func_name
==
"has_connection"
:
value_content
=
params
.
get
(
ct
.
value_content
,
False
)
res_obj
=
res
if
res
is
not
None
else
False
assert
res_obj
==
value_content
return
True
...
...
tests/python_client/common/common_type.py
浏览文件 @
b2a2ef18
...
...
@@ -52,7 +52,7 @@ max_compaction_interval = 60 # the max time interval (s) from the last compacti
max_field_num
=
256
# Maximum number of fields in a collection
Not_Exist
=
"Not_Exist"
Connect_Object_Name
=
"Milvus"
Connect_Object_Name
=
True
list_content
=
"list_content"
dict_content
=
"dict_content"
value_content
=
"value_content"
...
...
tests/python_client/requirements.txt
浏览文件 @
b2a2ef18
...
...
@@ -12,7 +12,7 @@ allure-pytest==2.7.0
pytest-print==0.2.1
pytest-level==0.1.1
pytest-xdist==2.2.1
pymilvus==2.0.0rc
9.dev24
pymilvus==2.0.0rc
10.dev5
pytest-rerunfailures==9.1.1
git+https://github.com/Projectplace/pytest-tags
ndg-httpsclient
...
...
tests/python_client/testcases/test_collection.py
浏览文件 @
b2a2ef18
...
...
@@ -1138,13 +1138,14 @@ class TestCollectionDataframe(TestcaseBase):
method: create collection and insert with dataframe
expected: collection num entities equal to nb
"""
conn
=
self
.
_connect
()
self
.
_connect
()
c_name
=
cf
.
gen_unique_str
(
prefix
)
df
=
cf
.
gen_default_dataframe_data
(
ct
.
default_nb
)
self
.
collection_wrap
.
construct_from_dataframe
(
c_name
,
df
,
primary_field
=
ct
.
default_int64_field_name
,
check_task
=
CheckTasks
.
check_collection_property
,
check_items
=
{
exp_name
:
c_name
,
exp_schema
:
default_schema
})
conn
.
flush
([
c_name
])
# flush
self
.
collection_wrap
.
num_entities
assert
self
.
collection_wrap
.
num_entities
==
ct
.
default_nb
@
pytest
.
mark
.
tags
(
CaseLabel
.
L0
)
...
...
@@ -1406,7 +1407,7 @@ class TestCollectionDataframe(TestcaseBase):
method: create collection with dup name, none schema, dataframe
expected: two collection object is correct
"""
conn
=
self
.
_connect
()
self
.
_connect
()
c_name
=
cf
.
gen_unique_str
(
prefix
)
collection_w
=
self
.
init_collection_wrap
(
name
=
c_name
,
primary_field
=
ct
.
default_int64_field_name
,
check_task
=
CheckTasks
.
check_collection_property
,
...
...
@@ -1415,7 +1416,8 @@ class TestCollectionDataframe(TestcaseBase):
self
.
collection_wrap
.
construct_from_dataframe
(
c_name
,
df
,
primary_field
=
ct
.
default_int64_field_name
,
check_task
=
CheckTasks
.
check_collection_property
,
check_items
=
{
exp_name
:
c_name
,
exp_schema
:
default_schema
})
conn
.
flush
([
collection_w
.
name
])
# flush
self
.
collection_wrap
.
num_entities
assert
collection_w
.
num_entities
==
ct
.
default_nb
assert
collection_w
.
num_entities
==
self
.
collection_wrap
.
num_entities
...
...
tests/python_client/testcases/test_connection.py
浏览文件 @
b2a2ef18
...
...
@@ -67,7 +67,7 @@ class TestConnectionParams(TestcaseBase):
self
.
connection_wrap
.
connect
(
alias
=
alias
,
check_task
=
ct
.
CheckTasks
.
err_res
,
check_items
=
{
ct
.
err_code
:
0
,
ct
.
err_msg
:
cem
.
AliasType
%
type
(
alias
)})
@
pytest
.
mark
.
tags
(
ct
.
CaseLabel
.
L2
)
@
pytest
.
mark
.
skip
(
"get_connection is replaced by has_connection"
)
@
pytest
.
mark
.
parametrize
(
"alias"
,
ct
.
get_not_string
)
def
test_connection_get_alias_param_check
(
self
,
alias
):
"""
...
...
@@ -173,8 +173,8 @@ class TestConnectionOperation(TestcaseBase):
alias2
=
{
"host"
:
"192.168.1.1"
,
"port"
:
"123"
})
# get the object of alias
self
.
connection_wrap
.
get
_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
value_content
:
Non
e
})
self
.
connection_wrap
.
has
_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
value_content
:
Fals
e
})
# list all connections and check the response
self
.
connection_wrap
.
list_connections
(
check_task
=
ct
.
CheckTasks
.
ccr
,
...
...
@@ -436,7 +436,7 @@ class TestConnectionOperation(TestcaseBase):
# list all connections and check the response
self
.
connection_wrap
.
list_connections
(
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
list_content
:
[(
DefaultConfig
.
DEFAULT_USING
,
ct
.
Connect_Object_Name
)]})
"GrpcHandler"
)]})
# get all addr of alias and check the response
self
.
connection_wrap
.
get_connection_addr
(
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
ct
.
CheckTasks
.
ccr
,
...
...
@@ -458,14 +458,14 @@ class TestConnectionOperation(TestcaseBase):
self
.
connection_wrap
.
connect
(
alias
=
connect_name
,
check_task
=
ct
.
CheckTasks
.
ccr
)
# get the object of alias
res_obj1
=
self
.
connection_wrap
.
get
_connection
(
alias
=
connect_name
,
check_task
=
ct
.
CheckTasks
.
ccr
,
res_obj1
=
self
.
connection_wrap
.
has
_connection
(
alias
=
connect_name
,
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
value_content
:
ct
.
Connect_Object_Name
})[
0
]
# connect twice with the same params
self
.
connection_wrap
.
connect
(
alias
=
connect_name
,
host
=
host
,
port
=
port
,
check_task
=
ct
.
CheckTasks
.
ccr
)
# get the object of alias
res_obj2
=
self
.
connection_wrap
.
get
_connection
(
alias
=
connect_name
,
check_task
=
ct
.
CheckTasks
.
ccr
,
res_obj2
=
self
.
connection_wrap
.
has
_connection
(
alias
=
connect_name
,
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
value_content
:
ct
.
Connect_Object_Name
})[
0
]
# check the response of the same alias is equal
...
...
@@ -490,11 +490,11 @@ class TestConnectionOperation(TestcaseBase):
self
.
connection_wrap
.
connect
(
alias
=
connect_name
,
host
=
host
,
port
=
port
,
check_task
=
ct
.
CheckTasks
.
ccr
)
# get the object of alias
self
.
connection_wrap
.
get
_connection
(
alias
=
connect_name
,
check_task
=
ct
.
CheckTasks
.
ccr
,
self
.
connection_wrap
.
has
_connection
(
alias
=
connect_name
,
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
value_content
:
ct
.
Connect_Object_Name
})
# list all connections and check the response
list_content
=
[(
connect_name
,
ct
.
Connect_Object_Name
)]
if
connect_name
is
DefaultConfig
.
DEFAULT_USING
else
\
list_content
=
[(
connect_name
,
"GrpcHandler"
)]
if
connect_name
is
DefaultConfig
.
DEFAULT_USING
else
\
[(
DefaultConfig
.
DEFAULT_USING
,
None
),
(
connect_name
,
ct
.
Connect_Object_Name
)]
self
.
connection_wrap
.
list_connections
(
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
list_content
:
list_content
})
...
...
@@ -558,7 +558,7 @@ class TestConnectionOperation(TestcaseBase):
method: 1. connect with default alias
2. get connection
3. disconnect with default alias
4.
get
connection
4.
has
connection
5. disconnect again
6. list connections and get connection address
expected: the connection was successfully terminated
...
...
@@ -571,15 +571,15 @@ class TestConnectionOperation(TestcaseBase):
self
.
connection_wrap
.
connect
(
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
ct
.
CheckTasks
.
ccr
)
# get the object of alias
self
.
connection_wrap
.
get
_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
ct
.
CheckTasks
.
ccr
,
self
.
connection_wrap
.
has
_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
value_content
:
ct
.
Connect_Object_Name
})
# disconnect alias is exist
self
.
connection_wrap
.
disconnect
(
alias
=
DefaultConfig
.
DEFAULT_USING
)
# get the object of alias
self
.
connection_wrap
.
get
_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
value_content
:
Non
e
})
self
.
connection_wrap
.
has
_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
value_content
:
Fals
e
})
# disconnect twice
self
.
connection_wrap
.
disconnect
(
alias
=
DefaultConfig
.
DEFAULT_USING
)
...
...
@@ -613,7 +613,7 @@ class TestConnectionOperation(TestcaseBase):
self
.
connection_wrap
.
list_connections
(
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
list_content
:
[(
DefaultConfig
.
DEFAULT_USING
,
None
),
(
test_alias_name
,
ct
.
Connect_Object_Name
)]})
test_alias_name
,
"GrpcHandler"
)]})
# get all addr of alias and check the response
self
.
connection_wrap
.
get_connection_addr
(
alias
=
test_alias_name
,
check_task
=
ct
.
CheckTasks
.
ccr
,
...
...
@@ -676,8 +676,8 @@ class TestConnectionOperation(TestcaseBase):
self
.
connection_wrap
.
remove_connection
(
alias
=
connect_name
)
# get the object of alias
self
.
connection_wrap
.
get
_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
value_content
:
Non
e
})
self
.
connection_wrap
.
has
_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_task
=
ct
.
CheckTasks
.
ccr
,
check_items
=
{
ct
.
value_content
:
Fals
e
})
# list all connections and check the response
list_content
=
[]
if
connect_name
==
DefaultConfig
.
DEFAULT_USING
else
[(
DefaultConfig
.
DEFAULT_USING
,
None
)]
...
...
@@ -795,9 +795,6 @@ class TestConnect:
expected: connected is True
"""
uri_value
=
""
if
self
.
local_ip
(
args
):
milvus
=
get_milvus
(
None
,
None
,
uri
=
uri_value
,
handler
=
args
[
"handler"
])
else
:
with
pytest
.
raises
(
Exception
)
as
e
:
milvus
=
get_milvus
(
None
,
None
,
uri
=
uri_value
,
handler
=
args
[
"handler"
])
...
...
tests/python_client/testcases/test_delete.py
浏览文件 @
b2a2ef18
...
...
@@ -399,7 +399,6 @@ class TestDeleteOperation(TestcaseBase):
collection_w
.
query
(
expr
=
f
'
{
ct
.
default_int64_field_name
}
in
{
[
0
,
tmp_nb
]
}
'
,
check_task
=
CheckTasks
.
check_query_empty
)
@
pytest
.
mark
.
skip
(
"enable this later using session/strong consistency"
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_delete_search
(
self
):
"""
...
...
tests/python_client/testcases/test_index.py
浏览文件 @
b2a2ef18
...
...
@@ -199,7 +199,8 @@ class TestIndexOperation(TestcaseBase):
collection_w
=
self
.
init_collection_wrap
(
name
=
c_name
)
data
=
cf
.
gen_default_list_data
()
collection_w
.
insert
(
data
=
data
)
self
.
_connect
().
flush
([
collection_w
.
name
])
# flush
collection_w
.
num_entities
index
,
_
=
self
.
index_wrap
.
init_index
(
collection_w
.
collection
,
default_field_name
,
default_index_params
)
# TODO: assert index
cf
.
assert_equal_index
(
index
,
collection_w
.
collection
.
indexes
[
0
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录