Add case for segment and update case nprobe 0 and partition limit (#3751)

* case segment_row_count

Signed-off-by: ThreadDao <zongyufen@foxmail.com>

* fix case

Signed-off-by: ThreadDao <zongyufen@foxmail.com>
This commit is contained in:
ThreadDao 2020-09-15 19:09:04 +08:00 committed by GitHub
parent 12c573abdc
commit fbca2c99fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View File

@ -148,6 +148,16 @@ class TestInsertBase:
logging.getLogger().debug(res)
assert res
def test_insert_segment_row_count(self, connect, collection):
nb = segment_row_count + 1
res_ids = connect.insert(collection, gen_entities(nb))
connect.flush([collection])
assert len(res_ids) == nb
stats = connect.get_collection_stats(collection)
assert len(stats['partitions'][0]['segments']) == 2
for segment in stats['partitions'][0]['segments']:
assert segment['row_count'] in [segment_row_count, 1]
@pytest.fixture(
scope="function",
params=[
@ -522,7 +532,7 @@ class TestInsertBase:
method: disable autoflush and insert, get entity
expected: the count is equal to 0
'''
delete_nums = 500;
delete_nums = 500
disable_flush(connect)
ids = connect.insert(collection, entities)
res = connect.get_entity_by_id(collection, ids[:delete_nums])

View File

@ -1607,7 +1607,7 @@ class TestSearchInvalid(object):
index_type = "BIN_IVF_FLAT"
int_vectors, entities, ids = init_binary_data(connect, binary_collection)
query_int_vectors, query_entities, tmp_ids = init_binary_data(connect, binary_collection, nb=1, insert=False)
connect.create_index(binary_collection, binary_field_name, {"index_type": index_type, "metric_type": "JACCARD", "params": {"nlist": 1024}})
connect.create_index(binary_collection, binary_field_name, {"index_type": index_type, "metric_type": "JACCARD", "params": {"nlist": 128}})
query, vecs = gen_query_vectors(binary_field_name, query_entities, top_k, nq, search_params={"nprobe": 0}, metric_type="JACCARD")
with pytest.raises(Exception) as e:
res = connect.search(binary_collection, query)

View File

@ -219,7 +219,7 @@ class TestRestartBase:
delete_length = 1000
loop = 10
for i in range(loop):
delete_ids = ids[i*loop:i*loop+delete_length]
delete_ids = ids[i*delete_length:(i+1)*delete_length]
delete_res = connect.delete_entity_by_id(collection, delete_ids)
connect.flush([collection])
connect.compact(collection, _async=True)

View File

@ -39,7 +39,7 @@ class TestCreateBase:
# TODO: enable
@pytest.mark.level(2)
@pytest.mark.timeout(1200)
def _test_create_partition_limit(self, connect, collection, args):
def test_create_partition_limit(self, connect, collection, args):
'''
target: test create partitions, check status returned
method: call function: create_partition for 4097 times