Modify test case for unique primary keys (#10221)

Signed-off-by: Binbin Lv <binbin.lv@zilliz.com>
This commit is contained in:
binbin 2021-10-19 21:20:35 +08:00 committed by GitHub
parent ebfb30eae1
commit fd6f1e54ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -485,7 +485,7 @@ def gen_partitions(collection_w, partition_num=1):
def insert_data(collection_w, nb=3000, is_binary=False, is_all_data_type=False,
auto_id=False, dim=ct.default_dim):
auto_id=False, dim=ct.default_dim, insert_offset=0):
"""
target: insert non-binary/binary data
method: insert non-binary/binary data into partitions if any
@ -496,16 +496,16 @@ def insert_data(collection_w, nb=3000, is_binary=False, is_all_data_type=False,
vectors = []
binary_raw_vectors = []
insert_ids = []
start = 0
start = insert_offset
log.info("insert_data: inserting data into collection %s (num_entities: %s)"
% (collection_w.name, nb))
for i in range(num):
default_data = gen_default_dataframe_data(nb // num, dim=dim, start=start)
if is_binary:
default_data, binary_raw_data = gen_default_binary_dataframe_data(nb // num, dim=dim)
default_data, binary_raw_data = gen_default_binary_dataframe_data(nb // num, dim=dim, start=start)
binary_raw_vectors.extend(binary_raw_data)
if is_all_data_type:
default_data = gen_dataframe_all_data_type(nb // num, dim=dim)
default_data = gen_dataframe_all_data_type(nb // num, dim=dim, start=start)
if auto_id:
default_data.drop(ct.default_int64_field_name, axis=1, inplace=True)
insert_res = collection_w.insert(default_data, par[i].name)[0]

View File

@ -1082,7 +1082,7 @@ class TestCollectionSearch(TestcaseBase):
# 3. insert new data
nb_new = 300
insert_ids_new = cf.insert_data(collection_w, nb_new,
auto_id=auto_id, dim=dim)[3]
auto_id=auto_id, dim=dim, insert_offset=nb_old)[3]
insert_ids.extend(insert_ids_new)
# gracefulTime is default as 1s which allows data
# could not be searched instantly in gracefulTime