mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
test: update sdk version and cases (#42077)
Signed-off-by: nico <cheng.yuan@zilliz.com>
This commit is contained in:
parent
f55f900c85
commit
c827f4b948
@ -281,7 +281,6 @@ class ResponseChecker:
|
|||||||
assert dim_list[0] == dim_list_expected
|
assert dim_list[0] == dim_list_expected
|
||||||
else:
|
else:
|
||||||
assert dim_list == dim_list_expected
|
assert dim_list == dim_list_expected
|
||||||
assert res["fields"][1]["params"]["dim"] == check_items.get("dim")
|
|
||||||
if check_items.get("nullable_fields", None) is not None:
|
if check_items.get("nullable_fields", None) is not None:
|
||||||
nullable_fields = check_items.get("nullable_fields")
|
nullable_fields = check_items.get("nullable_fields")
|
||||||
if not isinstance(nullable_fields, list):
|
if not isinstance(nullable_fields, list):
|
||||||
|
|||||||
@ -333,9 +333,9 @@ class TestMilvusClientCollectionValid(TestMilvusClientV2Base):
|
|||||||
schema = self.create_schema(client, enable_dynamic_field=False)[0]
|
schema = self.create_schema(client, enable_dynamic_field=False)[0]
|
||||||
schema.add_field("id_int64", DataType.INT64, is_primary=True, auto_id=False)
|
schema.add_field("id_int64", DataType.INT64, is_primary=True, auto_id=False)
|
||||||
schema.add_field("embeddings", DataType.FLOAT_VECTOR, dim=dim)
|
schema.add_field("embeddings", DataType.FLOAT_VECTOR, dim=dim)
|
||||||
schema.add_field("int8embeddings_1", DataType.INT8_VECTOR, dim=dim * 2)
|
schema.add_field("embeddings_1", DataType.INT8_VECTOR, dim=dim * 2)
|
||||||
schema.add_field("int8embeddings_2", DataType.FLOAT16_VECTOR, dim=int(dim / 2))
|
schema.add_field("embeddings_2", DataType.FLOAT16_VECTOR, dim=int(dim / 2))
|
||||||
schema.add_field("int8embeddings_3", DataType.BFLOAT16_VECTOR, dim=int(dim / 2))
|
schema.add_field("embeddings_3", DataType.BFLOAT16_VECTOR, dim=int(dim / 2))
|
||||||
index_params = self.prepare_index_params(client)[0]
|
index_params = self.prepare_index_params(client)[0]
|
||||||
index_params.add_index("embeddings", metric_type="COSINE")
|
index_params.add_index("embeddings", metric_type="COSINE")
|
||||||
index_params.add_index("embeddings_1", metric_type="IP")
|
index_params.add_index("embeddings_1", metric_type="IP")
|
||||||
@ -346,7 +346,7 @@ class TestMilvusClientCollectionValid(TestMilvusClientV2Base):
|
|||||||
collections = self.list_collections(client)[0]
|
collections = self.list_collections(client)[0]
|
||||||
assert collection_name in collections
|
assert collection_name in collections
|
||||||
check_items = {"collection_name": collection_name,
|
check_items = {"collection_name": collection_name,
|
||||||
"dim": [dim, dim * 2, dim / 2, dim / 2],
|
"dim": [dim, dim * 2, int(dim / 2), int(dim / 2)],
|
||||||
"consistency_level": 0,
|
"consistency_level": 0,
|
||||||
"enable_dynamic_field": False,
|
"enable_dynamic_field": False,
|
||||||
"id_name": "id_int64",
|
"id_name": "id_int64",
|
||||||
|
|||||||
@ -189,7 +189,7 @@ class TestMilvusClientDatabaseInvalid(TestMilvusClientV2Base):
|
|||||||
self.create_collection(client, collection_name, default_dim)
|
self.create_collection(client, collection_name, default_dim)
|
||||||
collections = self.list_collections(client)[0]
|
collections = self.list_collections(client)[0]
|
||||||
assert collection_name in collections
|
assert collection_name in collections
|
||||||
#3. drop database
|
# 3. drop database
|
||||||
error = {ct.err_code: 65535, ct.err_msg: f"{db_name} not empty, must drop all collections before drop database"}
|
error = {ct.err_code: 65535, ct.err_msg: f"{db_name} not empty, must drop all collections before drop database"}
|
||||||
self.drop_database(client, db_name,
|
self.drop_database(client, db_name,
|
||||||
check_task=CheckTasks.err_res, check_items=error)
|
check_task=CheckTasks.err_res, check_items=error)
|
||||||
@ -205,10 +205,8 @@ class TestMilvusClientDatabaseInvalid(TestMilvusClientV2Base):
|
|||||||
expected: raise exception
|
expected: raise exception
|
||||||
"""
|
"""
|
||||||
client = self._client()
|
client = self._client()
|
||||||
error = {ct.err_code: 1, ct.err_msg: f"Unexpected error, message=<GrpcHandler.list_database() "
|
res, _ = self.list_databases(client, db_name=db_name)
|
||||||
f"got an unexpected keyword argument 'db_name'"}
|
assert "default" in res
|
||||||
self.list_databases(client, db_name=db_name,
|
|
||||||
check_task=CheckTasks.err_res, check_items=error)
|
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L1)
|
@pytest.mark.tags(CaseLabel.L1)
|
||||||
@pytest.mark.parametrize("db_name", ["12-s", "12 s", "(mn)", "中文", "%$#", " ", "nonexistent"])
|
@pytest.mark.parametrize("db_name", ["12-s", "12 s", "(mn)", "中文", "%$#", " ", "nonexistent"])
|
||||||
|
|||||||
@ -579,7 +579,7 @@ class TestMilvusClientQueryJsonPathIndex(TestMilvusClientV2Base):
|
|||||||
self.flush(client, collection_name)
|
self.flush(client, collection_name)
|
||||||
# 4. query when there is no json path index under all expressions
|
# 4. query when there is no json path index under all expressions
|
||||||
# skip negative expression for issue 40685
|
# skip negative expression for issue 40685
|
||||||
# "my_json['a'] != 1", "my_json['a'] != 1.0", "my_json['a'] != '1'", "my_json['a'] != 1.1", "my_json['a'] not in [1]"
|
# "my_json['a'] != 1", "my_json['a'] != 1.0", "my_json['a'] != '1'", "my_json['a'] != 1.1", "my_json['a'] not in [1]"
|
||||||
express_list = cf.gen_json_field_expressions_all_single_operator()
|
express_list = cf.gen_json_field_expressions_all_single_operator()
|
||||||
compare_dict = {}
|
compare_dict = {}
|
||||||
for i in range(len(express_list)):
|
for i in range(len(express_list)):
|
||||||
|
|||||||
@ -506,7 +506,8 @@ class TestMilvusClientE2E(TestMilvusClientV2Base):
|
|||||||
|
|
||||||
# Multiple fields is not null
|
# Multiple fields is not null
|
||||||
multi_not_null_filter = "varchar_field is not null and json_field is not null and array_field is not null"
|
multi_not_null_filter = "varchar_field is not null and json_field is not null and array_field is not null"
|
||||||
multi_not_null_expected = [r for r in total_rows if r["varchar_field"] is not None and r["json_field"] is not None and r["array_field"] is not None]
|
multi_not_null_expected = [r for r in total_rows if r["varchar_field"] is not None and
|
||||||
|
r["json_field"] is not None and r["array_field"] is not None]
|
||||||
query_res, _ = self.query(
|
query_res, _ = self.query(
|
||||||
client,
|
client,
|
||||||
collection_name,
|
collection_name,
|
||||||
@ -524,8 +525,8 @@ class TestMilvusClientE2E(TestMilvusClientV2Base):
|
|||||||
# Test case 1: int field is null AND float field > value AND varchar field is not null
|
# Test case 1: int field is null AND float field > value AND varchar field is not null
|
||||||
complex_mix_filter1 = "int32_field is null and float_field > 10.0 and varchar_field is not null"
|
complex_mix_filter1 = "int32_field is null and float_field > 10.0 and varchar_field is not null"
|
||||||
complex_mix_expected1 = [r for r in total_rows if r["int32_field"] is None and
|
complex_mix_expected1 = [r for r in total_rows if r["int32_field"] is None and
|
||||||
r["float_field"] is not None and r["float_field"] > 10.0 and
|
r["float_field"] is not None and r["float_field"] > 10.0 and
|
||||||
r["varchar_field"] is not None]
|
r["varchar_field"] is not None]
|
||||||
query_res, _ = self.query(
|
query_res, _ = self.query(
|
||||||
client,
|
client,
|
||||||
collection_name,
|
collection_name,
|
||||||
@ -542,8 +543,8 @@ class TestMilvusClientE2E(TestMilvusClientV2Base):
|
|||||||
# Test case 2: varchar field is not null AND int field between values AND float field is null
|
# Test case 2: varchar field is not null AND int field between values AND float field is null
|
||||||
complex_mix_filter2 = "varchar_field is not null and 5 <= int64_field <= 15 and float_field is null"
|
complex_mix_filter2 = "varchar_field is not null and 5 <= int64_field <= 15 and float_field is null"
|
||||||
complex_mix_expected2 = [r for r in total_rows if r["varchar_field"] is not None and
|
complex_mix_expected2 = [r for r in total_rows if r["varchar_field"] is not None and
|
||||||
r["int64_field"] is not None and 5 <= r["int64_field"] <= 15 and
|
r["int64_field"] is not None and 5 <= r["int64_field"] <= 15 and
|
||||||
r["float_field"] is None]
|
r["float_field"] is None]
|
||||||
query_res, _ = self.query(
|
query_res, _ = self.query(
|
||||||
client,
|
client,
|
||||||
collection_name,
|
collection_name,
|
||||||
@ -558,10 +559,11 @@ class TestMilvusClientE2E(TestMilvusClientV2Base):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Test case 3: Multiple fields with mixed null/not null conditions and range comparisons
|
# Test case 3: Multiple fields with mixed null/not null conditions and range comparisons
|
||||||
complex_mix_filter3 = "int8_field is not null and int8_field < 50 and double_field is null and varchar_field is not null and varchar_field like \"varchar_2%\""
|
complex_mix_filter3 = ("int8_field is not null and int8_field < 50 and double_field is null and "
|
||||||
|
"varchar_field is not null and varchar_field like \"varchar_2%\"")
|
||||||
complex_mix_expected3 = [r for r in total_rows if r["int8_field"] is not None and r["int8_field"] < 50 and
|
complex_mix_expected3 = [r for r in total_rows if r["int8_field"] is not None and r["int8_field"] < 50 and
|
||||||
r["double_field"] is None and
|
r["double_field"] is None and
|
||||||
r["varchar_field"] is not None and r["varchar_field"].startswith("varchar_2")]
|
r["varchar_field"] is not None and r["varchar_field"].startswith("varchar_2")]
|
||||||
query_res, _ = self.query(
|
query_res, _ = self.query(
|
||||||
client,
|
client,
|
||||||
collection_name,
|
collection_name,
|
||||||
@ -595,4 +597,4 @@ class TestMilvusClientE2E(TestMilvusClientV2Base):
|
|||||||
|
|
||||||
# 8. Cleanup
|
# 8. Cleanup
|
||||||
self.release_collection(client, collection_name)
|
self.release_collection(client, collection_name)
|
||||||
self.drop_collection(client, collection_name)
|
self.drop_collection(client, collection_name)
|
||||||
|
|||||||
@ -2785,10 +2785,7 @@ class TestLoadCollection(TestcaseBase):
|
|||||||
assert collection_w.num_entities == ct.default_nb
|
assert collection_w.num_entities == ct.default_nb
|
||||||
collection_w.create_index(ct.default_float_vec_field_name, index_params=ct.default_flat_index)
|
collection_w.create_index(ct.default_float_vec_field_name, index_params=ct.default_flat_index)
|
||||||
|
|
||||||
collection_w.load(replica_number=replicas,
|
collection_w.load(replica_number=replicas)
|
||||||
check_task=CheckTasks.err_res,
|
|
||||||
check_items={"err_code": 1,
|
|
||||||
"err_msg": "`replica_number` value None is illegal"})
|
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L2)
|
@pytest.mark.tags(CaseLabel.L2)
|
||||||
def test_load_replica_greater_than_querynodes(self):
|
def test_load_replica_greater_than_querynodes(self):
|
||||||
@ -3147,6 +3144,7 @@ class TestDescribeCollection(TestcaseBase):
|
|||||||
assert isinstance(res['collection_id'], int) and isinstance(res['created_timestamp'], int)
|
assert isinstance(res['collection_id'], int) and isinstance(res['created_timestamp'], int)
|
||||||
del res['collection_id']
|
del res['collection_id']
|
||||||
del res['created_timestamp']
|
del res['created_timestamp']
|
||||||
|
del res['update_timestamp']
|
||||||
log.info(res)
|
log.info(res)
|
||||||
assert description == res
|
assert description == res
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user