test: update some cases (#32323)

Signed-off-by: nico <cheng.yuan@zilliz.com>
pull/32340/head
nico 2024-04-16 20:27:32 +08:00 committed by GitHub
parent 15b9319523
commit f0caf3a2da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 23 additions and 20 deletions

View File

@ -733,6 +733,7 @@ def gen_general_list_all_data_type(nb=ct.default_nb, dim=ct.default_dim, start=0
return insert_list
def gen_default_rows_data_all_data_type(nb=ct.default_nb, dim=ct.default_dim, start=0, with_json=True,
multiple_dim_array=[], multiple_vector_field_name=[], partition_id=0,
auto_id=False, primary_field=ct.default_int64_field_name):
@ -1714,7 +1715,7 @@ def insert_data(collection_w, nb=ct.default_nb, is_binary=False, is_all_data_typ
multiple_dim_array=multiple_dim_array,
multiple_vector_field_name=vector_name_list,
vector_data_type=vector_data_type,
auto_id = auto_id, primary_field=primary_field)
auto_id=auto_id, primary_field=primary_field)
elif vector_data_type == "FLOAT16_VECTOR" or "BFLOAT16_VECTOR":
default_data = gen_general_default_list_data(nb // num, dim=dim, start=start, with_json=with_json,
random_primary_key=random_primary_key,

View File

@ -4149,6 +4149,7 @@ class TestCollectionARRAY(TestcaseBase):
ct.err_msg: "the value of max_capacity must be an integer"})
@pytest.mark.tags(CaseLabel.L2)
@pytest.mark.skip("https://github.com/milvus-io/pymilvus/issues/2041")
@pytest.mark.parametrize("max_capacity", [[], 'a', (), -1, 4097])
def test_collection_array_field_invalid_capacity(self, max_capacity):
"""
@ -4184,6 +4185,7 @@ class TestCollectionARRAY(TestcaseBase):
"varChar field of collection"})
@pytest.mark.tags(CaseLabel.L2)
@pytest.mark.skip("https://github.com/milvus-io/pymilvus/issues/2041")
@pytest.mark.parametrize("max_length", [[], 'a', (), -1, 65536])
def test_collection_string_array_max_length_invalid(self, max_length):
"""

View File

@ -951,7 +951,7 @@ class TestNewIndexBase(TestcaseBase):
index_name=ct.default_index_name)
self.connection_wrap.remove_connection(ct.default_alias)
collection_w.drop_index(index_name=ct.default_index_name, check_task=CheckTasks.err_res,
check_items={ct.err_code: 0, ct.err_msg: "should create connect first."})
check_items={ct.err_code: 1, ct.err_msg: "should create connect first."})
@pytest.mark.tags(CaseLabel.L2)
def test_create_drop_index_repeatedly(self, get_simple_index):

View File

@ -172,11 +172,10 @@ class TestInsertParams(TestcaseBase):
"""
c_name = cf.gen_unique_str(prefix)
collection_w = self.init_collection_wrap(name=c_name)
mutation_res, _ = collection_w.insert(data=None)
assert mutation_res.insert_count == 0
assert len(mutation_res.primary_keys) == 0
assert collection_w.is_empty
assert collection_w.num_entities == 0
mutation_res, _ = collection_w.insert(data=None, check_task=CheckTasks.err_res,
check_items={ct.err_code: 1,
ct.err_msg: "The type of data should be List, "
"pd.DataFrame or Dict"})
@pytest.mark.tags(CaseLabel.L1)
def test_insert_numpy_data(self):
@ -248,10 +247,9 @@ class TestInsertParams(TestcaseBase):
collection_w = self.init_collection_wrap(name=c_name)
dim = 129
df = cf.gen_default_dataframe_data(ct.default_nb, dim=dim)
error = {ct.err_code: 1,
error = {ct.err_code: 65535,
ct.err_msg: f'Collection field dim is {ct.default_dim}, but entities field dim is {dim}'}
collection_w.insert(
data=df, check_task=CheckTasks.err_res, check_items=error)
collection_w.insert(data=df, check_task=CheckTasks.err_res, check_items=error)
@pytest.mark.tags(CaseLabel.L2)
def test_insert_binary_dim_not_match(self):
@ -265,10 +263,10 @@ class TestInsertParams(TestcaseBase):
name=c_name, schema=default_binary_schema)
dim = 120
df, _ = cf.gen_default_binary_dataframe_data(ct.default_nb, dim=dim)
error = {ct.err_code: 1,
ct.err_msg: f'Collection field dim is {ct.default_dim}, but entities field dim is {dim}'}
collection_w.insert(
data=df, check_task=CheckTasks.err_res, check_items=error)
error = {ct.err_code: 1100,
ct.err_msg: f'the dim ({dim}) of field data(binary_vector) is not equal to schema dim '
f'({ct.default_dim}): invalid parameter[expected={dim}][actual={ct.default_dim}]'}
collection_w.insert(data=df, check_task=CheckTasks.err_res, check_items=error)
@pytest.mark.tags(CaseLabel.L2)
def test_insert_field_name_not_match(self):
@ -1784,8 +1782,9 @@ class TestUpsertValid(TestcaseBase):
"""
collection_w = self.init_collection_general(pre_upsert, insert_data=True, is_index=False)[0]
assert collection_w.num_entities == ct.default_nb
collection_w.upsert(data=None)
assert collection_w.num_entities == ct.default_nb
collection_w.upsert(data=None, check_task=CheckTasks.err_res,
check_items={ct.err_code: 1,
ct.err_msg: "The type of data should be List, pd.DataFrame or Dict"})
@pytest.mark.tags(CaseLabel.L1)
def test_upsert_in_specific_partition(self):
@ -2139,7 +2138,7 @@ class TestUpsertInvalid(TestcaseBase):
"""
collection_w = self.init_collection_general(pre_upsert, True, is_binary=True)[0]
data = cf.gen_default_binary_dataframe_data(dim=dim)[0]
error = {ct.err_code: 1,
error = {ct.err_code: 1100,
ct.err_msg: f"Collection field dim is 128, but entities field dim is {dim}"}
collection_w.upsert(data=data, check_task=CheckTasks.err_res, check_items=error)

View File

@ -1010,7 +1010,7 @@ class TestPartitionOperations(TestcaseBase):
data = cf.gen_default_list_data(nb=10, dim=dim)
# insert data to partition
partition_w.insert(data, check_task=CheckTasks.err_res,
check_items={ct.err_code: 1, ct.err_msg: "but entities field dim"})
check_items={ct.err_code: 65535, ct.err_msg: "but entities field dim"})
@pytest.mark.tags(CaseLabel.L1)
@pytest.mark.parametrize("sync", [True, False])
@ -1115,7 +1115,7 @@ class TestPartitionOperations(TestcaseBase):
# upsert mismatched data
upsert_data = cf.gen_default_data_for_upsert(dim=ct.default_dim-1)[0]
error = {ct.err_code: 1, ct.err_msg: "Collection field dim is 128, but entities field dim is 127"}
error = {ct.err_code: 65535, ct.err_msg: "Collection field dim is 128, but entities field dim is 127"}
partition_w.upsert(upsert_data, check_task=CheckTasks.err_res, check_items=error)
@pytest.mark.tags(CaseLabel.L2)

View File

@ -1961,6 +1961,7 @@ class TestQueryParams(TestcaseBase):
f"should be in range [1, 16384], but got {offset}"})
@pytest.mark.tags(CaseLabel.L2)
@pytest.mark.skip("not stable")
def test_query_during_upsert(self):
"""
target: test query during upsert

View File

@ -10059,7 +10059,7 @@ class TestSearchGroupBy(TestcaseBase):
"""
collection_w = self.init_collection_general(prefix, auto_id=True, insert_data=False, is_index=False,
is_binary=True)[0]
_index = {"index_type": "HNSW", "metric_type": metric, "params": {"M": 16, "efConstruction": 128}}
_index = {"index_type": "BIN_FLAT", "metric_type": metric, "params": {"M": 16, "efConstruction": 128}}
collection_w.create_index(ct.default_binary_vec_field_name, index_params=_index)
# insert with the same values for scalar fields
for _ in range(10):