未验证 提交 3ec8c382 编写于 作者: C chen qingxiang 提交者: GitHub

fix compact bug and change some test case level from 2 to 1 (#3219)

* fix compact bug and change some test case level from 2 to 1
Signed-off-by: Ngodchen0212 <qingxiang.chen@zilliz.com>

* format code
Signed-off-by: Ngodchen0212 <qingxiang.chen@zilliz.com>

* change wrong test case
Signed-off-by: Ngodchen0212 <qingxiang.chen@zilliz.com>

* fix ping test case bug
Signed-off-by: Ngodchen0212 <qingxiang.chen@zilliz.com>
上级 18d67772
......@@ -749,7 +749,7 @@ DBImpl::Compact(const std::shared_ptr<server::Context>& context, const std::stri
}
auto deleted_count = deleted_docs->GetCount();
if (deleted_count / (row_count + deleted_count) < threshold) {
if (double(deleted_count) / (row_count + deleted_count) < threshold) {
continue; // no need to compact
}
......
......@@ -158,7 +158,6 @@ class TestCollectionCount:
res = connect.count_entities(collection)
assert res == insert_count
@pytest.mark.level(2)
def test_count_without_connection(self, collection, dis_connect):
'''
target: test count_entities, without connection
......
......@@ -69,7 +69,6 @@ class TestStatsBase:
with pytest.raises(Exception) as e:
stats = connect.get_collection_stats(collection_name)
@pytest.mark.level(2)
def test_get_collection_stats_name_invalid(self, connect, get_collection_name):
'''
target: get collection stats where collection name is invalid
......@@ -122,8 +121,6 @@ class TestStatsBase:
assert stats["partitions"][0]["tag"] == "_default"
assert stats["partitions"][0]["row_count"] == nb
# TODO
@pytest.mark.level(2)
def test_get_collection_stats_after_delete(self, connect, collection):
'''
target: get row count with collection_stats
......@@ -138,10 +135,9 @@ class TestStatsBase:
stats = connect.get_collection_stats(collection)
assert stats["row_count"] == nb - 2
assert stats["partitions"][0]["segments"][0]["data_size"] > 0
assert stats["partitions"][0]["segments"][0]["index_name"] == "FLAT"
# TODO
# assert stats["partitions"][0]["segments"][0]["index_type"] == "FLAT"
# TODO
@pytest.mark.level(2)
def test_get_collection_stats_after_compact_parts(self, connect, collection):
'''
target: get row count with collection_stats
......@@ -161,11 +157,8 @@ class TestStatsBase:
stats = connect.get_collection_stats(collection)
logging.getLogger().info(stats)
compact_after = stats["partitions"][0]["segments"][0]["data_size"]
# pdb.set_trace()
assert compact_before > compact_after
# TODO
@pytest.mark.level(2)
def test_get_collection_stats_after_compact_delete_one(self, connect, collection):
'''
target: get row count with collection_stats
......@@ -225,8 +218,6 @@ class TestStatsBase:
if partition["tag"] in [tag, new_tag]:
assert partition["row_count"] == nb
# TODO
@pytest.mark.level(2)
def test_get_collection_stats_after_index_created(self, connect, collection, get_simple_index):
'''
target: test collection info after index created
......@@ -239,10 +230,9 @@ class TestStatsBase:
stats = connect.get_collection_stats(collection)
logging.getLogger().info(stats)
assert stats["partitions"][0]["segments"][0]["row_count"] == nb
assert stats["partitions"][0]["segments"][0]["index_name"] == get_simple_index["index_type"]
# TODO
# assert stats["partitions"][0]["segments"][0]["index_name"] == get_simple_index["index_type"]
# TODO
@pytest.mark.level(2)
def test_get_collection_stats_after_index_created_ip(self, connect, collection, get_simple_index):
'''
target: test collection info after index created
......@@ -257,7 +247,8 @@ class TestStatsBase:
stats = connect.get_collection_stats(collection)
logging.getLogger().info(stats)
assert stats["partitions"][0]["segments"][0]["row_count"] == nb
assert stats["partitions"][0]["segments"][0]["index_name"] == get_simple_index["index_type"]
# TODO
# assert stats["partitions"][0]["segments"][0]["index_name"] == get_simple_index["index_type"]
def test_get_collection_stats_after_index_created_jac(self, connect, binary_collection, get_jaccard_index):
'''
......@@ -271,10 +262,9 @@ class TestStatsBase:
stats = connect.get_collection_stats(binary_collection)
logging.getLogger().info(stats)
assert stats["partitions"][0]["segments"][0]["row_count"] == nb
assert stats["partitions"][0]["segments"][0]["index_name"] == get_jaccard_index["index_type"]
# TODO
# assert stats["partitions"][0]["segments"][0]["index_name"] == get_jaccard_index["index_type"]
# TODO
@pytest.mark.level(2)
def test_get_collection_stats_after_create_different_index(self, connect, collection):
'''
target: test collection info after index created repeatedly
......@@ -287,7 +277,8 @@ class TestStatsBase:
connect.create_index(collection, field_name, {"index_type": index_type, "params":{"nlist": 1024}, "metric_type": "L2"})
stats = connect.get_collection_stats(collection)
logging.getLogger().info(stats)
assert stats["partitions"][0]["segments"][0]["index_name"] == index_type
# TODO
# assert stats["partitions"][0]["segments"][0]["index_name"] == index_type
assert stats["partitions"][0]["segments"][0]["row_count"] == nb
def test_collection_count_multi_collections(self, connect):
......@@ -310,8 +301,6 @@ class TestStatsBase:
assert stats["partitions"][0]["segments"][0]["row_count"] == nb
connect.drop_collection(collection_list[i])
# TODO
@pytest.mark.level(2)
def test_collection_count_multi_collections_indexed(self, connect):
'''
target: test collection rows_count is correct or not with multiple collections of L2
......@@ -334,8 +323,9 @@ class TestStatsBase:
for i in range(collection_num):
stats = connect.get_collection_stats(collection_list[i])
assert stats["partitions"][0]["segments"][0]["row_count"] == nb
if i % 2:
assert stats["partitions"][0]["segments"][0]["index_name"] == "IVF_SQ8"
else:
assert stats["partitions"][0]["segments"][0]["index_name"] == "IVF_FLAT"
# TODO
# if i % 2:
# assert stats["partitions"][0]["segments"][0]["index_name"] == "IVF_SQ8"
# else:
# assert stats["partitions"][0]["segments"][0]["index_name"] == "IVF_FLAT"
connect.drop_collection(collection_list[i])
......@@ -132,7 +132,6 @@ class TestCreateCollection:
connect.create_collection(collection, default_fields)
# TODO: assert exception
@pytest.mark.level(2)
def test_create_collection_without_connection(self, dis_connect):
'''
target: test create collection, without connection
......
......@@ -28,7 +28,6 @@ class TestDropCollection:
time.sleep(2)
assert not connect.has_collection(collection)
@pytest.mark.level(2)
def test_drop_collection_without_connection(self, collection, dis_connect):
'''
target: test describe collection, without connection
......@@ -61,19 +60,16 @@ class TestDropCollectionInvalid(object):
def get_collection_name(self, request):
yield request.param
@pytest.mark.level(2)
def test_drop_collection_with_invalid_collectionname(self, connect, get_collection_name):
collection_name = get_collection_name
with pytest.raises(Exception) as e:
connect.has_collection(collection_name)
@pytest.mark.level(2)
def test_drop_collection_with_empty_collectionname(self, connect):
collection_name = ''
with pytest.raises(Exception) as e:
connect.has_collection(collection_name)
@pytest.mark.level(2)
def test_drop_collection_with_none_collectionname(self, connect):
collection_name = None
with pytest.raises(Exception) as e:
......
......@@ -98,8 +98,6 @@ class TestInfoBase:
with pytest.raises(Exception) as e:
res = connect.get_collection_info(connect, collection_name)
# TODO
@pytest.mark.level(2)
def test_get_collection_info_multithread(self, connect):
'''
target: test create collection with multithread
......
......@@ -129,8 +129,6 @@ class TestDeleteBase:
res_count = connect.count_entities(collection)
assert res_count == nb - 1
# TODO
@pytest.mark.level(2)
def test_insert_delete_B(self, connect, id_collection):
'''
target: test delete entity
......@@ -177,8 +175,6 @@ class TestDeleteBase:
res_count = connect.count_entities(collection)
assert res_count == nb - len(delete_ids)
# TODO
@pytest.mark.level(2)
def test_flush_after_delete_binary(self, connect, binary_collection):
'''
target: test delete entity
......@@ -194,8 +190,6 @@ class TestDeleteBase:
res_count = connect.count_entities(binary_collection)
assert res_count == nb - len(delete_ids)
# TODO
@pytest.mark.level(2)
def test_insert_same_ids_after_delete(self, connect, id_collection):
'''
method: add entities and delete
......@@ -214,8 +208,6 @@ class TestDeleteBase:
res_count = connect.count_entities(id_collection)
assert res_count == nb - 1
# TODO
@pytest.mark.level(2)
def test_insert_same_ids_after_delete_binary(self, connect, binary_id_collection):
'''
method: add entities, with the same id and delete the ids
......@@ -233,8 +225,6 @@ class TestDeleteBase:
res_count = connect.count_entities(binary_id_collection)
assert res_count == nb - 1
# TODO:
@pytest.mark.level(2)
def test_search_after_delete(self, connect, collection):
'''
target: test delete entity
......@@ -255,8 +245,6 @@ class TestDeleteBase:
assert res[1]._distances[0] < epsilon
assert res[2]._distances[0] < epsilon
# TODO
@pytest.mark.level(2)
def test_create_index_after_delete(self, connect, collection, get_simple_index):
'''
method: add entitys and delete, then create index
......@@ -285,8 +273,6 @@ class TestDeleteBase:
status = connect.delete_entity_by_id(collection, delete_ids)
assert status
# TODO
@pytest.mark.level(2)
def test_index_insert_batch_delete_get(self, connect, collection, get_simple_index):
'''
method: create index, insert entities, and delete
......@@ -304,8 +290,6 @@ class TestDeleteBase:
res_get = connect.get_entity_by_id(collection, delete_ids)
assert res_get[0] is None
# TODO
@pytest.mark.level(2)
def test_index_insert_single_delete_get(self, connect, id_collection, get_simple_index):
'''
method: create index, insert entities, and delete
......@@ -373,8 +357,6 @@ class TestDeleteBase:
res_count = connect.count_entities(collection)
assert res_count == 2 * (nb - 1)
# TODO:
@pytest.mark.level(2)
def test_insert_tags_index_delete(self, connect, collection, get_simple_index):
'''
method: add entitys with given tag, create index, delete entities with the return ids
......
......@@ -111,8 +111,6 @@ class TestGetBase:
with pytest.raises(Exception) as e:
res = connect.get_entity_by_id(collection, ids)
# TODO
@pytest.mark.level(2)
def test_get_entity_same_ids(self, connect, id_collection):
'''
target: test.get_entity_by_id, with the same ids
......@@ -127,8 +125,6 @@ class TestGetBase:
assert len(res) == 1
assert_equal_vector(res[0].get(default_float_vec_field_name), entities[-1]["values"][0])
# TODO
@pytest.mark.level(2)
def test_get_entity_params_same_ids(self, connect, id_collection):
'''
target: test.get_entity_by_id, with the same ids
......@@ -244,7 +240,6 @@ class TestGetBase:
for i in range(get_pos):
assert_equal_vector(res[i].get(default_float_vec_field_name), entities[-1]["values"][i])
@pytest.mark.skip
def test_get_entities_tags_B(self, connect, collection, get_pos):
'''
target: test.get_entity_by_id
......@@ -266,7 +261,6 @@ class TestGetBase:
for i in range(get_pos, get_pos*2):
assert_equal_vector(res[i].get(default_float_vec_field_name), new_entities[-1]["values"][i-get_pos])
@pytest.mark.level(2)
def test_get_entities_indexed_tag(self, connect, collection, get_simple_index, get_pos):
'''
target: test.get_entity_by_id
......@@ -343,9 +337,6 @@ class TestGetBase:
with pytest.raises(Exception) as e:
res = connect.get_entity_by_id(collection, get_ids, fields = fields)
# TODO
@pytest.mark.level(2)
@pytest.mark.skip
def test_get_entity_id_not_exised(self, connect, collection):
'''
target: test get entity, params entity_id not existed
......@@ -374,8 +365,6 @@ class TestGetBase:
The following cases are used to test `get_entity_by_id` function, after deleted
******************************************************************
"""
# TODO
@pytest.mark.level(2)
def test_get_entity_after_delete(self, connect, collection, get_pos):
'''
target: test.get_entity_by_id
......@@ -391,8 +380,6 @@ class TestGetBase:
res = connect.get_entity_by_id(collection, get_ids)
assert res[0] is None
# TODO
@pytest.mark.level(2)
def test_get_entities_after_delete(self, connect, collection, get_pos):
'''
target: test.get_entity_by_id
......@@ -409,8 +396,6 @@ class TestGetBase:
for i in range(get_pos):
assert res[i] is None
# TODO
@pytest.mark.level(2)
def test_get_entities_after_delete_compact(self, connect, collection, get_pos):
'''
target: test.get_entity_by_id
......@@ -428,7 +413,6 @@ class TestGetBase:
for i in range(get_pos):
assert res[i] is None
@pytest.mark.level(2)
def test_get_entities_indexed_batch(self, connect, collection, get_simple_index, get_pos):
'''
target: test.get_entity_by_id
......@@ -443,7 +427,6 @@ class TestGetBase:
for i in range(get_pos):
assert_equal_vector(res[i].get(default_float_vec_field_name), entities[-1]["values"][i])
@pytest.mark.level(2)
def test_get_entities_indexed_single(self, connect, collection, get_simple_index, get_pos):
'''
target: test.get_entity_by_id
......@@ -460,8 +443,6 @@ class TestGetBase:
for i in range(get_pos):
assert_equal_vector(res[i].get(default_float_vec_field_name), entity[-1]["values"][0])
# TODO
@pytest.mark.level(2)
def test_get_entities_after_delete_disable_autoflush(self, connect, collection, get_pos):
'''
target: test.get_entity_by_id
......@@ -481,8 +462,6 @@ class TestGetBase:
finally:
enable_flush(connect)
# TODO:
@pytest.mark.level(2)
def test_get_entities_after_delete_same_ids(self, connect, id_collection):
'''
target: test.get_entity_by_id
......@@ -499,8 +478,6 @@ class TestGetBase:
res = connect.get_entity_by_id(id_collection, get_ids)
assert res[0] is None
# TODO
@pytest.mark.level(2)
def test_get_entity_after_delete_with_partition(self, connect, collection, get_pos):
'''
target: test.get_entity_by_id
......
......@@ -116,7 +116,6 @@ class TestInsertBase:
connect.flush([collection])
connect.drop_collection(collection)
@pytest.mark.level(2)
@pytest.mark.timeout(ADD_TIMEOUT)
def test_insert_create_index(self, connect, collection, get_simple_index):
'''
......@@ -129,7 +128,6 @@ class TestInsertBase:
connect.flush([collection])
connect.create_index(collection, field_name, get_simple_index)
@pytest.mark.level(2)
@pytest.mark.timeout(ADD_TIMEOUT)
def test_insert_after_create_index(self, connect, collection, get_simple_index):
'''
......@@ -141,8 +139,6 @@ class TestInsertBase:
ids = connect.insert(collection, entities)
assert len(ids) == nb
# TODO
@pytest.mark.level(2)
@pytest.mark.timeout(ADD_TIMEOUT)
def test_insert_search(self, connect, collection):
'''
......@@ -166,8 +162,6 @@ class TestInsertBase:
def insert_count(self, request):
yield request.param
# TODO
@pytest.mark.level(2)
@pytest.mark.timeout(ADD_TIMEOUT)
def test_insert_ids(self, connect, id_collection, insert_count):
'''
......@@ -184,8 +178,6 @@ class TestInsertBase:
res_count = connect.count_entities(id_collection)
assert res_count == nb
# TODO
@pytest.mark.level(2)
@pytest.mark.timeout(ADD_TIMEOUT)
def test_insert_the_same_ids(self, connect, id_collection, insert_count):
'''
......@@ -310,8 +302,6 @@ class TestInsertBase:
ids = connect.insert(collection, entities, partition_tag=tag)
assert len(ids) == nb
# TODO
@pytest.mark.level(2)
@pytest.mark.timeout(ADD_TIMEOUT)
def test_insert_tag_with_ids(self, connect, id_collection):
'''
......@@ -588,8 +578,6 @@ class TestAddAsync:
future = connect.insert(collection, gen_entities(nb), _async=True, _callback=self.check_status)
future.done()
# TODO:
@pytest.mark.level(2)
def _test_insert_async_long(self, connect, collection):
'''
target: test insert vectors with different length of vectors
......@@ -692,7 +680,6 @@ class TestInsertMultiCollections:
connect.flush([collection_name])
assert len(ids) == 1
@pytest.mark.level(2)
@pytest.mark.timeout(ADD_TIMEOUT)
def test_create_index_insert_vector_another(self, connect, collection, get_simple_index):
'''
......@@ -706,7 +693,6 @@ class TestInsertMultiCollections:
ids = connect.insert(collection, entity)
connect.drop_collection(collection_name)
@pytest.mark.level(2)
@pytest.mark.timeout(ADD_TIMEOUT)
def test_insert_vector_create_index_another(self, connect, collection, get_simple_index):
'''
......@@ -721,7 +707,6 @@ class TestInsertMultiCollections:
count = connect.count_entities(collection_name)
assert count == 0
@pytest.mark.level(2)
@pytest.mark.timeout(ADD_TIMEOUT)
def test_insert_vector_sleep_create_index_another(self, connect, collection, get_simple_index):
'''
......
......@@ -196,7 +196,6 @@ class TestListIdInSegmentBase:
assert len(vector_ids) == 1
assert vector_ids[0] == ids[1]
@pytest.mark.level(2)
def test_list_id_in_segment_with_index_ip(self, connect, collection, get_simple_index):
'''
target: get vector ids when there is index
......
......@@ -118,8 +118,6 @@ class TestCompactBase:
size_after = info["partitions"][0]["segments"][0]["data_size"]
assert(size_before == size_after)
# TODO
@pytest.mark.level(2)
@pytest.mark.timeout(COMPACT_TIMEOUT)
def test_insert_and_compact(self, connect, collection):
'''
......@@ -170,8 +168,9 @@ class TestCompactBase:
logging.getLogger().info(size_after)
assert(size_before >= size_after)
# TODO
@pytest.mark.skip("not implement")
@pytest.mark.timeout(COMPACT_TIMEOUT)
@pytest.mark.skip("not implemented")
def test_insert_delete_all_and_compact(self, connect, collection):
'''
target: test add entities, delete them and compact
......@@ -194,7 +193,6 @@ class TestCompactBase:
assert not info["partitions"][0]["segments"]
@pytest.mark.timeout(COMPACT_TIMEOUT)
@pytest.mark.skip("not implemented")
def test_insert_partition_delete_half_and_compact(self, connect, collection):
'''
target: test add entities into partition, delete them and compact
......@@ -235,9 +233,7 @@ class TestCompactBase:
pytest.skip("CPU not support index_type: ivf_sq8h")
return request.param
# TODO
@pytest.mark.skip('not implemented')
@pytest.mark.level(2)
def test_compact_after_index_created(self, connect, collection, get_simple_index):
'''
target: test compact collection after index created
......@@ -253,7 +249,7 @@ class TestCompactBase:
info = connect.get_collection_stats(collection)
size_before = info["partitions"][0]["segments"][0]["data_size"]
logging.getLogger().info(info["partitions"])
delete_ids = [ids[0], ids[-1]]
delete_ids = ids[:1500]
status = connect.delete_entity_by_id(collection, delete_ids)
assert status.OK()
connect.flush([collection])
......@@ -265,8 +261,6 @@ class TestCompactBase:
size_after = info["partitions"][0]["segments"][0]["data_size"]
assert(size_before >= size_after)
# TODO
@pytest.mark.level(2)
@pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_entity_and_compact_twice(self, connect, collection):
'''
......@@ -322,8 +316,6 @@ class TestCompactBase:
size_after_twice = info["partitions"][0]["segments"][0]["data_size"]
assert(size_after == size_after_twice)
# TODO
@pytest.mark.level(2)
@pytest.mark.timeout(COMPACT_TIMEOUT)
def test_compact_multi_collections(self, connect):
'''
......@@ -345,7 +337,6 @@ class TestCompactBase:
status = connect.compact(collection_list[i])
assert status.OK()
@pytest.mark.level(2)
@pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_entity_after_compact(self, connect, collection):
'''
......@@ -463,8 +454,6 @@ class TestCompactBinary:
******************************************************************
"""
@pytest.mark.timeout(COMPACT_TIMEOUT)
# TODO
@pytest.mark.level(2)
def test_add_entity_and_compact(self, connect, binary_collection):
'''
target: test add binary vector and compact
......@@ -484,8 +473,6 @@ class TestCompactBinary:
size_after = info["partitions"][0]["segments"][0]["data_size"]
assert(size_before == size_after)
# TODO
@pytest.mark.level(2)
@pytest.mark.timeout(COMPACT_TIMEOUT)
def test_insert_and_compact(self, connect, binary_collection):
'''
......@@ -534,8 +521,10 @@ class TestCompactBinary:
logging.getLogger().info(size_after)
assert(size_before >= size_after)
# TODO
@pytest.mark.skip("not implement")
@pytest.mark.level(2)
@pytest.mark.timeout(COMPACT_TIMEOUT)
@pytest.mark.skip('not implemented')
def test_insert_delete_all_and_compact(self, connect, binary_collection):
'''
target: test add entities, delete them and compact
......@@ -558,8 +547,6 @@ class TestCompactBinary:
logging.getLogger().info(info["partitions"])
assert not info["partitions"][0]["segments"]
# TODO
@pytest.mark.level(2)
@pytest.mark.timeout(COMPACT_TIMEOUT)
def test_add_entity_and_compact_twice(self, connect, binary_collection):
'''
......
......@@ -87,8 +87,6 @@ class TestFlushBase:
# with pytest.raises(Exception) as e:
# connect.flush([collection])
# TODO
@pytest.mark.level(2)
def test_add_partition_flush(self, connect, id_collection):
'''
method: add entities into partition in collection, flush serveral times
......@@ -108,8 +106,6 @@ class TestFlushBase:
res_count = connect.count_entities(id_collection)
assert res_count == nb * 2
# TODO
@pytest.mark.level(2)
def test_add_partitions_flush(self, connect, id_collection):
'''
method: add entities into partitions in collection, flush one
......@@ -127,8 +123,6 @@ class TestFlushBase:
res = connect.count_entities(id_collection)
assert res == 2 * nb
# TODO
@pytest.mark.level(2)
def test_add_collections_flush(self, connect, id_collection):
'''
method: add entities into collections, flush one
......@@ -150,8 +144,6 @@ class TestFlushBase:
res = connect.count_entities(collection_new)
assert res == nb
# TODO
@pytest.mark.level(2)
def test_add_collections_fields_flush(self, connect, id_collection, get_filter_field, get_vector_field):
'''
method: create collection with different fields, and add entities into collections, flush one
......@@ -199,8 +191,6 @@ class TestFlushBase:
logging.getLogger().debug(res)
assert res
# TODO
@pytest.mark.level(2)
# TODO: stable case
def test_add_flush_auto(self, connect, id_collection):
'''
......@@ -230,8 +220,6 @@ class TestFlushBase:
def same_ids(self, request):
yield request.param
# TODO
@pytest.mark.level(2)
def test_add_flush_same_ids(self, connect, id_collection, same_ids):
'''
method: add entities, with same ids, count(same ids) < 15, > 15
......
......@@ -58,7 +58,6 @@ class TestIndexBase:
******************************************************************
"""
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index(self, connect, collection, get_simple_index):
'''
......@@ -69,7 +68,6 @@ class TestIndexBase:
ids = connect.insert(collection, entities)
connect.create_index(collection, field_name, get_simple_index)
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_no_vectors(self, connect, collection, get_simple_index):
'''
......@@ -79,7 +77,6 @@ class TestIndexBase:
'''
connect.create_index(collection, field_name, get_simple_index)
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_partition(self, connect, collection, get_simple_index):
'''
......@@ -92,7 +89,6 @@ class TestIndexBase:
connect.flush([collection])
connect.create_index(collection, field_name, get_simple_index)
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_partition_flush(self, connect, collection, get_simple_index):
'''
......@@ -105,8 +101,6 @@ class TestIndexBase:
connect.flush()
connect.create_index(collection, field_name, get_simple_index)
@pytest.mark.level(2)
@pytest.mark.level(2)
def test_create_index_without_connect(self, dis_connect, collection):
'''
target: test create index without connection
......@@ -116,7 +110,6 @@ class TestIndexBase:
with pytest.raises(Exception) as e:
dis_connect.create_index(collection, field_name, get_simple_index)
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_search_with_query_vectors(self, connect, collection, get_simple_index, get_nq):
'''
......@@ -158,7 +151,6 @@ class TestIndexBase:
for t in threads:
t.join()
@pytest.mark.level(2)
def test_create_index_collection_not_existed(self, connect):
'''
target: test create index interface when collection name not existed
......@@ -168,9 +160,8 @@ class TestIndexBase:
'''
collection_name = gen_unique_str(collection_id)
with pytest.raises(Exception) as e:
connect.create_index(collection, field_name, default_index)
connect.create_index(collection_name, field_name, default_index)
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_no_vectors_insert(self, connect, collection, get_simple_index):
'''
......@@ -205,14 +196,13 @@ class TestIndexBase:
expected: return code 0, and describe index result equals with the second index params
'''
ids = connect.insert(collection, entities)
indexs = [default_index, {"index_type": "FLAT", "nlist": 1024}]
indexs = [default_index, {"metric_type":"L2", "index_type": "FLAT", "params":{"nlist": 1024}}]
for index in indexs:
connect.create_index(collection, field_name, index)
stats = connect.get_collection_stats(collection)
# assert stats["partitions"][0]["segments"][0]["index_name"] == index["index_type"]
assert stats["row_count"] == nb
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_ip(self, connect, collection, get_simple_index):
'''
......@@ -224,7 +214,6 @@ class TestIndexBase:
get_simple_index["metric_type"] = "IP"
connect.create_index(collection, field_name, get_simple_index)
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_no_vectors_ip(self, connect, collection, get_simple_index):
'''
......@@ -235,7 +224,6 @@ class TestIndexBase:
get_simple_index["metric_type"] = "IP"
connect.create_index(collection, field_name, get_simple_index)
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_partition_ip(self, connect, collection, get_simple_index):
'''
......@@ -249,7 +237,6 @@ class TestIndexBase:
get_simple_index["metric_type"] = "IP"
connect.create_index(collection, field_name, get_simple_index)
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_partition_flush_ip(self, connect, collection, get_simple_index):
'''
......@@ -263,7 +250,6 @@ class TestIndexBase:
get_simple_index["metric_type"] = "IP"
connect.create_index(collection, field_name, get_simple_index)
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_search_with_query_vectors_ip(self, connect, collection, get_simple_index, get_nq):
'''
......@@ -320,8 +306,6 @@ class TestIndexBase:
with pytest.raises(Exception) as e:
connect.create_index(collection_name, field_name, default_index)
# TODO
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_no_vectors_insert_ip(self, connect, collection, get_simple_index):
'''
......@@ -371,7 +355,6 @@ class TestIndexBase:
******************************************************************
"""
@pytest.mark.level(2)
def test_drop_index(self, connect, collection, get_simple_index):
'''
target: test drop index interface
......@@ -411,7 +394,6 @@ class TestIndexBase:
with pytest.raises(Exception) as e:
dis_connect.drop_index(collection, field_name)
@pytest.mark.level(2)
def test_drop_index_collection_not_existed(self, connect):
'''
target: test drop index interface when collection name not existed
......@@ -423,7 +405,6 @@ class TestIndexBase:
with pytest.raises(Exception) as e:
connect.drop_index(collection_name, field_name)
@pytest.mark.level(2)
def test_drop_index_collection_not_create(self, connect, collection):
'''
target: test drop index interface when index not created
......@@ -445,7 +426,6 @@ class TestIndexBase:
connect.create_index(collection, field_name, get_simple_index)
connect.drop_index(collection, field_name)
@pytest.mark.level(2)
def test_drop_index_ip(self, connect, collection, get_simple_index):
'''
target: test drop index interface
......@@ -487,7 +467,6 @@ class TestIndexBase:
with pytest.raises(Exception) as e:
dis_connect.drop_index(collection, field_name)
@pytest.mark.level(2)
def test_drop_index_collection_not_create_ip(self, connect, collection):
'''
target: test drop index interface when index not created
......@@ -787,7 +766,6 @@ class TestIndexAsync:
******************************************************************
"""
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index(self, connect, collection, get_simple_index):
'''
......@@ -809,7 +787,6 @@ class TestIndexAsync:
with pytest.raises(Exception) as e:
res = future.result()
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_callback(self, connect, collection, get_simple_index):
'''
......
......@@ -98,8 +98,6 @@ class TestCreateBase:
assert tag_name in tag_list
assert "_default" in tag_list
# TODO
@pytest.mark.level(2)
def test_create_partition_insert_default(self, connect, id_collection):
'''
target: test create partition, and insert vectors, check status returned
......@@ -111,8 +109,6 @@ class TestCreateBase:
insert_ids = connect.insert(id_collection, entities, ids)
assert len(insert_ids) == len(ids)
# TODO
@pytest.mark.level(2)
def test_create_partition_insert_with_tag(self, connect, id_collection):
'''
target: test create partition, and insert vectors, check status returned
......@@ -136,8 +132,6 @@ class TestCreateBase:
with pytest.raises(Exception) as e:
insert_ids = connect.insert(collection, entities, ids, partition_tag=tag_new)
# TODO
@pytest.mark.level(2)
def test_create_partition_insert_same_tags(self, connect, id_collection):
'''
target: test create partition, and insert vectors, check status returned
......
......@@ -118,7 +118,7 @@ class TestPingDisconnect:
res = dis_connect.server_status()
@pytest.mark.level(2)
def test_server_version_with_timeout(self, connect):
def test_server_version_with_timeout(self, dis_connect):
'''
target: test get the server status with timeout settings after disconnect
method: call the server_status method after connected
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册