Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
a8f73051
M
milvus
项目概览
milvus
/
milvus
8 个月 前同步成功
通知
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 搜索 >>
未验证
提交
a8f73051
编写于
7月 17, 2023
作者:
N
nico
提交者:
GitHub
7月 17, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update pymilvus version and update some test cases (#25479)
Signed-off-by:
N
nico
<
cheng.yuan@zilliz.com
>
上级
f30b44d4
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
53 addition
and
36 deletion
+53
-36
ci/jenkins/Nightly.groovy
ci/jenkins/Nightly.groovy
+3
-1
tests/python_client/common/common_func.py
tests/python_client/common/common_func.py
+1
-1
tests/python_client/requirements.txt
tests/python_client/requirements.txt
+1
-1
tests/python_client/testcases/test_collection.py
tests/python_client/testcases/test_collection.py
+3
-3
tests/python_client/testcases/test_database.py
tests/python_client/testcases/test_database.py
+3
-3
tests/python_client/testcases/test_index.py
tests/python_client/testcases/test_index.py
+3
-4
tests/python_client/testcases/test_insert.py
tests/python_client/testcases/test_insert.py
+37
-14
tests/python_client/testcases/test_search.py
tests/python_client/testcases/test_search.py
+2
-9
未找到文件。
ci/jenkins/Nightly.groovy
浏览文件 @
a8f73051
...
...
@@ -196,6 +196,7 @@ pipeline {
def
clusterEnabled
=
"false"
def
mqMode
=
'pulsar'
int
e2e_timeout_seconds
=
5
*
60
*
60
int
parallel_num
=
6
def
tag
=
"L0 L1 L2"
if
(
"${MILVUS_SERVER_TYPE}"
==
"distributed-pulsar"
)
{
clusterEnabled
=
"true"
...
...
@@ -209,6 +210,7 @@ pipeline {
e2e_timeout_seconds
=
6
*
60
*
60
}
else
if
(
"${MILVUS_SERVER_TYPE}"
==
"standalone-authentication"
)
{
tag
=
"RBAC"
parallel_num
=
1
e2e_timeout_seconds
=
1
*
60
*
60
}
if
(
"${MILVUS_CLIENT}"
==
"pymilvus"
)
{
...
...
@@ -218,7 +220,7 @@ pipeline {
MILVUS_CLUSTER_ENABLED="${clusterEnabled}" \
TEST_TIMEOUT="${e2e_timeout_seconds}" \
MQ_MODE="${mqMode}" \
./ci_e2e.sh "-n
6
--tags ${tag}"
./ci_e2e.sh "-n
${parallel_num}
--tags ${tag}"
"""
}
else
{
error
"Error: Unsupported Milvus client: ${MILVUS_CLIENT}"
...
...
tests/python_client/common/common_func.py
浏览文件 @
a8f73051
...
...
@@ -1100,7 +1100,7 @@ def install_milvus_operator_specific_config(namespace, milvus_mode, release_name
def
get_wildcard_output_field_names
(
collection_w
,
output_fields
):
all_fields
=
collection_w
.
schema
.
fields
all_fields
=
[
field
.
name
for
field
in
collection_w
.
schema
.
fields
]
if
"*"
in
output_fields
:
output_fields
.
remove
(
"*"
)
output_fields
.
extend
(
all_fields
)
...
...
tests/python_client/requirements.txt
浏览文件 @
a8f73051
...
...
@@ -12,7 +12,7 @@ allure-pytest==2.7.0
pytest-print==0.2.1
pytest-level==0.1.1
pytest-xdist==2.5.0
pymilvus==2.4.0.dev
81
pymilvus==2.4.0.dev
100
pytest-rerunfailures==9.1.1
git+https://github.com/Projectplace/pytest-tags
ndg-httpsclient
...
...
tests/python_client/testcases/test_collection.py
浏览文件 @
a8f73051
...
...
@@ -3802,9 +3802,9 @@ class TestCollectionString(TestcaseBase):
vec_field
=
cf
.
gen_float_vec_field
()
string_field
=
cf
.
gen_string_field
(
is_primary
=
True
,
auto_id
=
True
)
fields
=
[
int_field
,
string_field
,
vec_field
]
error
=
{
ct
.
err_code
:
0
,
ct
.
err_msg
:
"The auto_id can only be specified on field with DataType.INT64"
}
self
.
collection_schema_wrap
.
init_collection_schema
(
fields
=
fields
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
schema
=
self
.
collection_schema_wrap
.
init_collection_schema
(
fields
=
fields
)[
0
]
self
.
init_collection_wrap
(
schema
=
schema
,
check_task
=
CheckTasks
.
check_collection_property
,
check_items
=
{
"schema"
:
schema
,
"primary"
:
ct
.
default_string_field_name
}
)
class
TestCollectionJSON
(
TestcaseBase
):
"""
...
...
tests/python_client/testcases/test_database.py
浏览文件 @
a8f73051
...
...
@@ -10,7 +10,7 @@ from utils.util_log import test_log as log
prefix
=
"db"
@
pytest
.
mark
.
tags
(
CaseLabel
.
L3
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
RBAC
)
class
TestDatabaseParams
(
TestcaseBase
):
""" Test case of database """
...
...
@@ -220,7 +220,7 @@ class TestDatabaseParams(TestcaseBase):
check_items
=
{
ct
.
err_code
:
1
,
ct
.
err_msg
:
"database not exist"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L3
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
RBAC
)
class
TestDatabaseOperation
(
TestcaseBase
):
def
teardown_method
(
self
,
method
):
...
...
@@ -531,7 +531,7 @@ class TestDatabaseOperation(TestcaseBase):
assert
collection_w
.
name
in
colls
@
pytest
.
mark
.
tags
(
CaseLabel
.
L3
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
RBAC
)
class
TestDatabaseOtherApi
(
TestcaseBase
):
""" test other interface that has db_name params"""
...
...
tests/python_client/testcases/test_index.py
浏览文件 @
a8f73051
...
...
@@ -1939,7 +1939,6 @@ class TestAutoIndex(TestcaseBase):
expected: raise exception
"""
collection_w
=
self
.
init_collection_general
(
prefix
,
is_binary
=
True
,
is_index
=
False
)[
0
]
collection_w
.
create_index
(
binary_field_name
,
{},
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"float vector is only supported"
})
collection_w
.
create_index
(
binary_field_name
,
{})
actual_index_params
=
collection_w
.
index
()[
0
].
params
assert
default_autoindex_params
==
actual_index_params
tests/python_client/testcases/test_insert.py
浏览文件 @
a8f73051
...
...
@@ -417,6 +417,10 @@ class TestInsertOperation(TestcaseBase):
def
auto_id
(
self
,
request
):
yield
request
.
param
@
pytest
.
fixture
(
scope
=
"function"
,
params
=
[
ct
.
default_int64_field_name
,
ct
.
default_string_field_name
])
def
pk_field
(
self
,
request
):
yield
request
.
param
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_insert_without_connection
(
self
):
"""
...
...
@@ -655,34 +659,34 @@ class TestInsertOperation(TestcaseBase):
assert
collection_w
.
indexes
[
0
]
==
index
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_insert_auto_id_true
(
self
):
def
test_insert_auto_id_true
(
self
,
pk_field
):
"""
target: test insert ids fields values when auto_id=True
method: 1.create collection with auto_id=True 2.insert without ids
expected: verify primary_keys and num_entities
"""
c_name
=
cf
.
gen_unique_str
(
prefix
)
schema
=
cf
.
gen_default_collection_schema
(
auto_id
=
True
)
schema
=
cf
.
gen_default_collection_schema
(
primary_field
=
pk_field
,
auto_id
=
True
)
collection_w
=
self
.
init_collection_wrap
(
name
=
c_name
,
schema
=
schema
)
df
=
cf
.
gen_default_dataframe_data
()
df
.
drop
(
ct
.
default_int64_field_name
,
axis
=
1
,
inplace
=
True
)
df
.
drop
(
pk_field
,
axis
=
1
,
inplace
=
True
)
mutation_res
,
_
=
collection_w
.
insert
(
data
=
df
)
assert
cf
.
_check_primary_keys
(
mutation_res
.
primary_keys
,
ct
.
default_nb
)
assert
collection_w
.
num_entities
==
ct
.
default_nb
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_insert_twice_auto_id_true
(
self
):
def
test_insert_twice_auto_id_true
(
self
,
pk_field
):
"""
target: test insert ids fields twice when auto_id=True
method: 1.create collection with auto_id=True 2.insert twice
expected: verify primary_keys unique
"""
c_name
=
cf
.
gen_unique_str
(
prefix
)
schema
=
cf
.
gen_default_collection_schema
(
auto_id
=
True
)
schema
=
cf
.
gen_default_collection_schema
(
primary_field
=
pk_field
,
auto_id
=
True
)
nb
=
10
collection_w
=
self
.
init_collection_wrap
(
name
=
c_name
,
schema
=
schema
)
df
=
cf
.
gen_default_dataframe_data
(
nb
)
df
.
drop
(
ct
.
default_int64_field_name
,
axis
=
1
,
inplace
=
True
)
df
.
drop
(
pk_field
,
axis
=
1
,
inplace
=
True
)
mutation_res
,
_
=
collection_w
.
insert
(
data
=
df
)
primary_keys
=
mutation_res
.
primary_keys
assert
cf
.
_check_primary_keys
(
primary_keys
,
nb
)
...
...
@@ -692,30 +696,34 @@ class TestInsertOperation(TestcaseBase):
assert
collection_w
.
num_entities
==
nb
*
2
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_insert_auto_id_true_list_data
(
self
):
def
test_insert_auto_id_true_list_data
(
self
,
pk_field
):
"""
target: test insert ids fields values when auto_id=True
method: 1.create collection with auto_id=True 2.insert list data with ids field values
expected: assert num entities
"""
c_name
=
cf
.
gen_unique_str
(
prefix
)
schema
=
cf
.
gen_default_collection_schema
(
auto_id
=
True
)
schema
=
cf
.
gen_default_collection_schema
(
primary_field
=
pk_field
,
auto_id
=
True
)
collection_w
=
self
.
init_collection_wrap
(
name
=
c_name
,
schema
=
schema
)
data
=
cf
.
gen_default_list_data
()
mutation_res
,
_
=
collection_w
.
insert
(
data
=
data
[
1
:])
if
pk_field
==
ct
.
default_int64_field_name
:
mutation_res
,
_
=
collection_w
.
insert
(
data
=
data
[
1
:])
else
:
del
data
[
2
]
mutation_res
,
_
=
collection_w
.
insert
(
data
=
data
)
assert
mutation_res
.
insert_count
==
ct
.
default_nb
assert
cf
.
_check_primary_keys
(
mutation_res
.
primary_keys
,
ct
.
default_nb
)
assert
collection_w
.
num_entities
==
ct
.
default_nb
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_insert_auto_id_true_with_dataframe_values
(
self
):
def
test_insert_auto_id_true_with_dataframe_values
(
self
,
pk_field
):
"""
target: test insert with auto_id=True
method: create collection with auto_id=True
expected: 1.verify num entities 2.verify ids
"""
c_name
=
cf
.
gen_unique_str
(
prefix
)
schema
=
cf
.
gen_default_collection_schema
(
auto_id
=
True
)
schema
=
cf
.
gen_default_collection_schema
(
primary_field
=
pk_field
,
auto_id
=
True
)
collection_w
=
self
.
init_collection_wrap
(
name
=
c_name
,
schema
=
schema
)
df
=
cf
.
gen_default_dataframe_data
(
nb
=
100
)
error
=
{
ct
.
err_code
:
1
,
ct
.
err_msg
:
"Please don't provide data for auto_id primary field: int64"
}
...
...
@@ -723,14 +731,14 @@ class TestInsertOperation(TestcaseBase):
assert
collection_w
.
is_empty
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_insert_auto_id_true_with_list_values
(
self
):
def
test_insert_auto_id_true_with_list_values
(
self
,
pk_field
):
"""
target: test insert with auto_id=True
method: create collection with auto_id=True
expected: 1.verify num entities 2.verify ids
"""
c_name
=
cf
.
gen_unique_str
(
prefix
)
schema
=
cf
.
gen_default_collection_schema
(
auto_id
=
True
)
schema
=
cf
.
gen_default_collection_schema
(
primary_field
=
pk_field
,
auto_id
=
True
)
collection_w
=
self
.
init_collection_wrap
(
name
=
c_name
,
schema
=
schema
)
data
=
cf
.
gen_default_list_data
(
nb
=
100
)
error
=
{
ct
.
err_code
:
1
,
ct
.
err_msg
:
"The fields don't match with schema fields, "
...
...
@@ -1167,7 +1175,22 @@ class TestInsertInvalid(TestcaseBase):
error
=
{
ct
.
err_code
:
1
,
ct
.
err_msg
:
"Data type is not support."
}
mutation_res
,
_
=
collection_w
.
insert
(
data
=
df
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_insert_invalid_with_pk_varchar_auto_id_true
(
self
):
"""
target: test insert invalid with pk varchar and auto id true
method: set pk varchar max length < 18, insert data
expected: raise exception
"""
string_field
=
cf
.
gen_string_field
(
is_primary
=
True
,
max_length
=
6
)
embedding_field
=
cf
.
gen_float_vec_field
()
schema
=
cf
.
gen_collection_schema
([
string_field
,
embedding_field
],
auto_id
=
True
)
collection_w
=
self
.
init_collection_wrap
(
schema
=
schema
)
data
=
[[[
random
.
random
()
for
_
in
range
(
ct
.
default_dim
)]
for
_
in
range
(
2
)]]
error
=
{
ct
.
err_code
:
1
,
ct
.
err_msg
:
"the length (18) of 0th string exceeds max length (6)"
}
collection_w
.
insert
(
data
=
data
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_insert_over_resource_limit
(
self
):
"""
target: test insert over RPC limitation 64MB (67108864)
...
...
tests/python_client/testcases/test_search.py
浏览文件 @
a8f73051
...
...
@@ -5,8 +5,6 @@ import numpy
import
threading
import
pytest
import
pandas
as
pd
import
decimal
from
decimal
import
Decimal
,
getcontext
from
time
import
sleep
import
heapq
...
...
@@ -3311,11 +3309,7 @@ class TestCollectionSearch(TestcaseBase):
output_fields
=
[
binary_field_name
])[
0
]
# 4. check the result vectors should be equal to the inserted
log
.
info
(
res
[
0
][
0
].
id
)
log
.
info
(
res
[
0
][
0
].
entity
.
float_vector
)
log
.
info
(
data
[
'binary_vector'
][
0
])
assert
res
[
0
][
0
].
entity
.
binary_vector
==
data
[
binary_field_name
][
res
[
0
][
0
].
id
]
# log.info(data['float_vector'][1])
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
parametrize
(
"dim"
,
[
32
,
128
,
768
])
...
...
@@ -3429,9 +3423,8 @@ class TestCollectionSearch(TestcaseBase):
"output_fields"
:
[
field_name
]})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
parametrize
(
"wildcard_output_fields"
,
[[
"*"
],
[
"*"
,
default_float_field_name
],
[
"*"
,
default_search_field
],
[
"%"
],
[
"%"
,
default_float_field_name
],
[
"*"
,
"%"
]])
@
pytest
.
mark
.
parametrize
(
"wildcard_output_fields"
,
[[
"*"
],
[
"*"
,
default_int64_field_name
],
[
"*"
,
default_search_field
]])
def
test_search_with_output_field_wildcard
(
self
,
wildcard_output_fields
,
auto_id
,
_async
,
enable_dynamic_field
):
"""
target: test search with output fields using wildcard
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录