mirror of https://github.com/milvus-io/milvus.git
parent
f3bdaa2ec6
commit
07339ad2b8
|
@ -49,6 +49,7 @@ class TestFlushBase:
|
|||
def get_vector_field(self, request):
|
||||
yield request.param
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_flush_collection_not_existed(self, connect, collection):
|
||||
'''
|
||||
target: test flush, params collection_name not existed
|
||||
|
@ -56,9 +57,15 @@ class TestFlushBase:
|
|||
expected: error raised
|
||||
'''
|
||||
collection_new = gen_unique_str("test_flush_1")
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.flush([collection_new])
|
||||
except Exception as e:
|
||||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "describe collection failed: can't find collection: %s" % collection_new
|
||||
|
||||
@pytest.mark.tags("fail")
|
||||
def test_flush_empty_collection(self, connect, collection):
|
||||
'''
|
||||
method: flush collection with no vectors
|
||||
|
@ -69,13 +76,14 @@ class TestFlushBase:
|
|||
assert len(ids) == default_nb
|
||||
# status = connect.delete_entity_by_id(collection, ids)
|
||||
# assert status.OK()
|
||||
# connect.flush([collection])
|
||||
connect.flush([collection])
|
||||
res = connect.get_collection_stats(collection)
|
||||
# print(res)
|
||||
# assert res == default_nb
|
||||
assert res["row_count"] == default_nb
|
||||
connect.flush([collection])
|
||||
# with pytest.raises(Exception) as e:
|
||||
# connect.flush([collection])
|
||||
|
||||
@pytest.mark.tags("fail")
|
||||
def test_add_partition_flush(self, connect, id_collection):
|
||||
'''
|
||||
method: add entities into partition in collection, flush serveral times
|
||||
|
@ -93,6 +101,7 @@ class TestFlushBase:
|
|||
res_count = connect.get_collection_stats(id_collection)
|
||||
assert res_count["row_count"] == default_nb * 2
|
||||
|
||||
@pytest.mark.tags("fail")
|
||||
def test_add_partitions_flush(self, connect, id_collection):
|
||||
'''
|
||||
method: add entities into partitions in collection, flush one
|
||||
|
@ -102,13 +111,14 @@ class TestFlushBase:
|
|||
connect.create_partition(id_collection, default_tag)
|
||||
connect.create_partition(id_collection, tag_new)
|
||||
ids = [i for i in range(default_nb)]
|
||||
ids = connect.insert(id_collection, default_entities, ids, partition_tag=default_tag)
|
||||
connect.insert(id_collection, default_entities, ids, partition_tag=default_tag)
|
||||
connect.flush([id_collection])
|
||||
ids = connect.insert(id_collection, default_entities, ids, partition_tag=tag_new)
|
||||
connect.insert(id_collection, default_entities, ids, partition_tag=tag_new)
|
||||
connect.flush([id_collection])
|
||||
res = connect.get_collection_stats(id_collection)
|
||||
assert res["row_count"] == 2 * default_nb
|
||||
|
||||
@pytest.mark.tags("fail")
|
||||
def test_add_collections_flush(self, connect, id_collection):
|
||||
'''
|
||||
method: add entities into collections, flush one
|
||||
|
@ -131,6 +141,7 @@ class TestFlushBase:
|
|||
res = connect.get_collection_stats(collection_new)
|
||||
assert res["row_count"] == default_nb
|
||||
|
||||
@pytest.mark.tags("fail")
|
||||
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
|
||||
|
@ -162,6 +173,7 @@ class TestFlushBase:
|
|||
res = connect.get_collection_stats(collection_new)
|
||||
assert res["row_count"] == nb_new
|
||||
|
||||
@pytest.mark.tags("fail")
|
||||
def test_add_flush_multiable_times(self, connect, collection):
|
||||
'''
|
||||
method: add entities, flush serveral times
|
||||
|
@ -177,6 +189,7 @@ class TestFlushBase:
|
|||
logging.getLogger().debug(res)
|
||||
assert res
|
||||
|
||||
@pytest.mark.tags("fail")
|
||||
def test_add_flush_auto(self, connect, id_collection):
|
||||
'''
|
||||
method: add entities
|
||||
|
@ -204,6 +217,7 @@ class TestFlushBase:
|
|||
def same_ids(self, request):
|
||||
yield request.param
|
||||
|
||||
@pytest.mark.tags("fail")
|
||||
def test_add_flush_same_ids(self, connect, id_collection, same_ids):
|
||||
'''
|
||||
method: add entities, with same ids, count(same ids) < 15, > 15
|
||||
|
@ -218,20 +232,21 @@ class TestFlushBase:
|
|||
res = connect.get_collection_stats(id_collection)
|
||||
assert res["row_count"] == default_nb
|
||||
|
||||
@pytest.mark.tags("fail")
|
||||
def test_delete_flush_multiable_times(self, connect, collection):
|
||||
'''
|
||||
method: delete entities, flush serveral times
|
||||
expected: no error raised
|
||||
'''
|
||||
ids = connect.insert(collection, default_entities)
|
||||
status = connect.delete_entity_by_id(collection, [ids[-1]])
|
||||
assert status.OK()
|
||||
# status = connect.delete_entity_by_id(collection, [ids[-1]])
|
||||
# assert status.OK()
|
||||
for i in range(10):
|
||||
connect.flush([collection])
|
||||
# query_vecs = [vectors[0], vectors[1], vectors[-1]]
|
||||
res = connect.search(collection, default_single_query)
|
||||
logging.getLogger().debug(res)
|
||||
assert res
|
||||
# assert res
|
||||
|
||||
# TODO: unable to set config
|
||||
@pytest.mark.level(2)
|
||||
|
@ -246,7 +261,7 @@ class TestFlushBase:
|
|||
connect.flush([collection])
|
||||
ids.extend(tmp_ids)
|
||||
disable_flush(connect)
|
||||
status = connect.delete_entity_by_id(collection, ids)
|
||||
# status = connect.delete_entity_by_id(collection, ids)
|
||||
|
||||
def flush():
|
||||
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
|
||||
|
@ -263,6 +278,7 @@ class TestFlushBase:
|
|||
res = connect.get_collection_stats(collection)
|
||||
assert res["row_count"] == 0
|
||||
|
||||
@pytest.mark.tags("fail")
|
||||
@pytest.mark.level(2)
|
||||
def test_delete_flush_during_search(self, connect, collection, args):
|
||||
'''
|
||||
|
@ -280,11 +296,12 @@ class TestFlushBase:
|
|||
time.sleep(0.1)
|
||||
future = connect.search(collection, query, _async=True)
|
||||
delete_ids = [ids[0], ids[-1]]
|
||||
status = connect.delete_entity_by_id(collection, delete_ids)
|
||||
# status = connect.delete_entity_by_id(collection, delete_ids)
|
||||
connect.flush([collection])
|
||||
res = future.result()
|
||||
# res = future.result()
|
||||
res_count = connect.get_collection_stats(collection, timeout=120)
|
||||
assert res_count["row_count"] == loops * default_nb - len(delete_ids)
|
||||
assert res_count["row_count"] == loops * default_nb
|
||||
# assert res_count["row_count"] == loops * default_nb - len(delete_ids)
|
||||
|
||||
|
||||
class TestFlushAsync:
|
||||
|
@ -302,6 +319,7 @@ class TestFlushAsync:
|
|||
def check_status(self):
|
||||
logging.getLogger().info("In callback check status")
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_flush_empty_collection(self, connect, collection):
|
||||
'''
|
||||
method: flush collection with no vectors
|
||||
|
@ -309,19 +327,28 @@ class TestFlushAsync:
|
|||
'''
|
||||
future = connect.flush([collection], _async=True)
|
||||
status = future.result()
|
||||
assert status is None
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_flush_async_long(self, connect, collection):
|
||||
ids = connect.insert(collection, default_entities)
|
||||
assert len(ids) == default_nb
|
||||
future = connect.flush([collection], _async=True)
|
||||
status = future.result()
|
||||
assert status is None
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_flush_async_long_drop_collection(self, connect, collection):
|
||||
for i in range(5):
|
||||
ids = connect.insert(collection, default_entities)
|
||||
assert len(ids) == default_nb
|
||||
future = connect.flush([collection], _async=True)
|
||||
assert future.result() is None
|
||||
logging.getLogger().info("DROP")
|
||||
connect.drop_collection(collection)
|
||||
res = connect.drop_collection(collection)
|
||||
assert res is None
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_flush_async(self, connect, collection):
|
||||
connect.insert(collection, default_entities)
|
||||
logging.getLogger().info("before")
|
||||
|
@ -329,6 +356,7 @@ class TestFlushAsync:
|
|||
logging.getLogger().info("after")
|
||||
future.done()
|
||||
status = future.result()
|
||||
assert status is None
|
||||
|
||||
|
||||
class TestCollectionNameInvalid(object):
|
||||
|
@ -344,6 +372,7 @@ class TestCollectionNameInvalid(object):
|
|||
def get_invalid_collection_name(self, request):
|
||||
yield request.param
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
@pytest.mark.level(2)
|
||||
def test_flush_with_invalid_collection_name(self, connect, get_invalid_collection_name):
|
||||
collection_name = get_invalid_collection_name
|
||||
|
|
|
@ -17,6 +17,8 @@ class TestCreateBase:
|
|||
The following cases are used to test `create_partition` function
|
||||
******************************************************************
|
||||
"""
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_create_partition_a(self, connect, collection):
|
||||
'''
|
||||
target: test create partition, check status returned
|
||||
|
@ -46,7 +48,7 @@ class TestCreateBase:
|
|||
|
||||
for i in range(threads_num):
|
||||
m = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"])
|
||||
t = threading.Thread(target=create, args=(m, threads_num, ))
|
||||
t = threading.Thread(target=create, args=(m, threads_num))
|
||||
threads.append(t)
|
||||
t.start()
|
||||
for t in threads:
|
||||
|
@ -55,6 +57,7 @@ class TestCreateBase:
|
|||
with pytest.raises(Exception) as e:
|
||||
connect.create_partition(collection, tag_tmp)
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_create_partition_repeat(self, connect, collection):
|
||||
'''
|
||||
target: test create partition, check status returned
|
||||
|
@ -62,10 +65,16 @@ class TestCreateBase:
|
|||
expected: status ok
|
||||
'''
|
||||
connect.create_partition(collection, default_tag)
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.create_partition(collection, default_tag)
|
||||
except Exception as e:
|
||||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "create partition failed: partition name = %s already exists" % default_tag
|
||||
assert compare_list_elements(connect.list_partitions(collection), [default_tag, '_default'])
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_create_partition_collection_not_existed(self, connect):
|
||||
'''
|
||||
target: test create partition, its owner collection name not existed in db, check status returned
|
||||
|
@ -73,9 +82,15 @@ class TestCreateBase:
|
|||
expected: status not ok
|
||||
'''
|
||||
collection_name = gen_unique_str()
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.create_partition(collection_name, default_tag)
|
||||
except Exception as e:
|
||||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "create partition failed: can't find collection: %s" % collection_name
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_create_partition_tag_name_None(self, connect, collection):
|
||||
'''
|
||||
target: test create partition, tag name set None, check status returned
|
||||
|
@ -83,9 +98,12 @@ class TestCreateBase:
|
|||
expected: status ok
|
||||
'''
|
||||
tag_name = None
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.create_partition(collection, tag_name)
|
||||
except Exception as e:
|
||||
assert e.args[0] == "`partition_tag` value None is illegal"
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_create_different_partition_tags(self, connect, collection):
|
||||
'''
|
||||
target: test create partition twice with different names
|
||||
|
@ -97,6 +115,7 @@ class TestCreateBase:
|
|||
connect.create_partition(collection, tag_name)
|
||||
assert compare_list_elements(connect.list_partitions(collection), [default_tag, tag_name, '_default'])
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_create_partition_insert_default(self, connect, id_collection):
|
||||
'''
|
||||
target: test create partition, and insert vectors, check status returned
|
||||
|
@ -107,7 +126,8 @@ class TestCreateBase:
|
|||
ids = [i for i in range(default_nb)]
|
||||
insert_ids = connect.insert(id_collection, default_entities, ids)
|
||||
assert len(insert_ids) == len(ids)
|
||||
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_create_partition_insert_with_tag(self, connect, id_collection):
|
||||
'''
|
||||
target: test create partition, and insert vectors, check status returned
|
||||
|
@ -119,6 +139,7 @@ class TestCreateBase:
|
|||
insert_ids = connect.insert(id_collection, default_entities, ids, partition_tag=default_tag)
|
||||
assert len(insert_ids) == len(ids)
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_create_partition_insert_with_tag_not_existed(self, connect, collection):
|
||||
'''
|
||||
target: test create partition, and insert vectors, check status returned
|
||||
|
@ -128,10 +149,15 @@ class TestCreateBase:
|
|||
tag_new = "tag_new"
|
||||
connect.create_partition(collection, default_tag)
|
||||
ids = [i for i in range(default_nb)]
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.insert(collection, default_entities, ids, partition_tag=tag_new)
|
||||
except Exception as e:
|
||||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "partitionID of partitionName:%s can not be find" % tag_new
|
||||
|
||||
@pytest.mark.skip("get_collection_stats")
|
||||
@pytest.mark.tags("fail")
|
||||
def test_create_partition_insert_same_tags(self, connect, id_collection):
|
||||
'''
|
||||
target: test create partition, and insert vectors, check status returned
|
||||
|
@ -141,13 +167,15 @@ class TestCreateBase:
|
|||
connect.create_partition(id_collection, default_tag)
|
||||
ids = [i for i in range(default_nb)]
|
||||
insert_ids = connect.insert(id_collection, default_entities, ids, partition_tag=default_tag)
|
||||
assert len(insert_ids) == default_nb
|
||||
ids = [(i+default_nb) for i in range(default_nb)]
|
||||
new_insert_ids = connect.insert(id_collection, default_entities, ids, partition_tag=default_tag)
|
||||
assert len(new_insert_ids) == default_nb
|
||||
connect.flush([id_collection])
|
||||
res = connect.get_collection_stats(id_collection)
|
||||
assert res["row_count"] == default_nb * 2
|
||||
|
||||
@pytest.mark.skip("get_collection_stats")
|
||||
@pytest.mark.tags("fail")
|
||||
@pytest.mark.level(2)
|
||||
def test_create_partition_insert_same_tags_two_collections(self, connect, collection):
|
||||
'''
|
||||
|
@ -160,7 +188,9 @@ class TestCreateBase:
|
|||
connect.create_collection(collection_new, default_fields)
|
||||
connect.create_partition(collection_new, default_tag)
|
||||
ids = connect.insert(collection, default_entities, partition_tag=default_tag)
|
||||
ids = connect.insert(collection_new, default_entities, partition_tag=default_tag)
|
||||
assert len(ids) == default_nb
|
||||
ids_new = connect.insert(collection_new, default_entities, partition_tag=default_tag)
|
||||
assert len(ids_new) == default_nb
|
||||
connect.flush([collection, collection_new])
|
||||
res = connect.get_collection_stats(collection)
|
||||
assert res["row_count"] == default_nb
|
||||
|
@ -175,6 +205,8 @@ class TestShowBase:
|
|||
The following cases are used to test `list_partitions` function
|
||||
******************************************************************
|
||||
"""
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_list_partitions(self, connect, collection):
|
||||
'''
|
||||
target: test show partitions, check status and partitions returned
|
||||
|
@ -184,6 +216,7 @@ class TestShowBase:
|
|||
connect.create_partition(collection, default_tag)
|
||||
assert compare_list_elements(connect.list_partitions(collection), [default_tag, '_default'])
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_list_partitions_no_partition(self, connect, collection):
|
||||
'''
|
||||
target: test show partitions with collection name, check status and partitions returned
|
||||
|
@ -193,6 +226,7 @@ class TestShowBase:
|
|||
res = connect.list_partitions(collection)
|
||||
assert compare_list_elements(res, ['_default'])
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_show_multi_partitions(self, connect, collection):
|
||||
'''
|
||||
target: test show partitions, check status and partitions returned
|
||||
|
@ -220,6 +254,7 @@ class TestHasBase:
|
|||
def get_tag_name(self, request):
|
||||
yield request.param
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_has_partition_a(self, connect, collection):
|
||||
'''
|
||||
target: test has_partition, check status and result
|
||||
|
@ -231,6 +266,7 @@ class TestHasBase:
|
|||
logging.getLogger().info(res)
|
||||
assert res
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_has_partition_multi_partitions(self, connect, collection):
|
||||
'''
|
||||
target: test has_partition, check status and result
|
||||
|
@ -243,6 +279,7 @@ class TestHasBase:
|
|||
res = connect.has_partition(collection, tag_name)
|
||||
assert res
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_has_partition_tag_not_existed(self, connect, collection):
|
||||
'''
|
||||
target: test has_partition, check status and result
|
||||
|
@ -253,15 +290,23 @@ class TestHasBase:
|
|||
logging.getLogger().info(res)
|
||||
assert not res
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_has_partition_collection_not_existed(self, connect, collection):
|
||||
'''
|
||||
target: test has_partition, check status and result
|
||||
method: then call function: has_partition, with collection not existed
|
||||
expected: status not ok
|
||||
'''
|
||||
with pytest.raises(Exception) as e:
|
||||
connect.has_partition("not_existed_collection", default_tag)
|
||||
collection_name = "not_existed_collection"
|
||||
try:
|
||||
connect.has_partition(collection_name, default_tag)
|
||||
except Exception as e:
|
||||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "HasPartition failed: can't find collection: %s" % collection_name
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
@pytest.mark.level(2)
|
||||
def test_has_partition_with_invalid_tag_name(self, connect, collection, get_tag_name):
|
||||
'''
|
||||
|
@ -282,6 +327,8 @@ class TestDropBase:
|
|||
The following cases are used to test `drop_partition` function
|
||||
******************************************************************
|
||||
"""
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_drop_partition_a(self, connect, collection):
|
||||
'''
|
||||
target: test drop partition, check status and partition if existed
|
||||
|
@ -295,6 +342,7 @@ class TestDropBase:
|
|||
res2 = connect.list_partitions(collection)
|
||||
assert default_tag not in res2
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_drop_partition_tag_not_existed(self, connect, collection):
|
||||
'''
|
||||
target: test drop partition, but tag not existed
|
||||
|
@ -303,9 +351,15 @@ class TestDropBase:
|
|||
'''
|
||||
connect.create_partition(collection, default_tag)
|
||||
new_tag = "new_tag"
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.drop_partition(collection, new_tag)
|
||||
except Exception as e:
|
||||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "DropPartition failed: partition %s does not exist" % new_tag
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_drop_partition_tag_not_existed_A(self, connect, collection):
|
||||
'''
|
||||
target: test drop partition, but collection not existed
|
||||
|
@ -314,9 +368,15 @@ class TestDropBase:
|
|||
'''
|
||||
connect.create_partition(collection, default_tag)
|
||||
new_collection = gen_unique_str()
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.drop_partition(new_collection, default_tag)
|
||||
except Exception as e:
|
||||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "DropPartition failed: can't find collection: %s" % new_collection
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
@pytest.mark.level(2)
|
||||
def test_drop_partition_repeatedly(self, connect, collection):
|
||||
'''
|
||||
|
@ -327,11 +387,17 @@ class TestDropBase:
|
|||
connect.create_partition(collection, default_tag)
|
||||
connect.drop_partition(collection, default_tag)
|
||||
time.sleep(2)
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.drop_partition(collection, default_tag)
|
||||
except Exception as e:
|
||||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "DropPartition failed: partition %s does not exist" % default_tag
|
||||
tag_list = connect.list_partitions(collection)
|
||||
assert default_tag not in tag_list
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_drop_partition_create(self, connect, collection):
|
||||
'''
|
||||
target: test drop partition, and create again, check status
|
||||
|
@ -362,6 +428,7 @@ class TestNameInvalid(object):
|
|||
def get_collection_name(self, request):
|
||||
yield request.param
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
@pytest.mark.level(2)
|
||||
def test_drop_partition_with_invalid_collection_name(self, connect, collection, get_collection_name):
|
||||
'''
|
||||
|
@ -374,6 +441,7 @@ class TestNameInvalid(object):
|
|||
with pytest.raises(Exception) as e:
|
||||
connect.drop_partition(collection_name, default_tag)
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
@pytest.mark.level(2)
|
||||
def test_drop_partition_with_invalid_tag_name(self, connect, collection, get_tag_name):
|
||||
'''
|
||||
|
@ -386,6 +454,7 @@ class TestNameInvalid(object):
|
|||
with pytest.raises(Exception) as e:
|
||||
connect.drop_partition(collection, tag_name)
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
@pytest.mark.level(2)
|
||||
def test_list_partitions_with_invalid_collection_name(self, connect, collection, get_collection_name):
|
||||
'''
|
||||
|
@ -401,25 +470,37 @@ class TestNameInvalid(object):
|
|||
|
||||
class TestNewCase(object):
|
||||
|
||||
def test_drop_default_partition_a(self, connect, collection):
|
||||
@pytest.mark.tags("0331")
|
||||
def test_drop_default_partition_A(self, connect, collection):
|
||||
'''
|
||||
target: test drop partition of default, check status returned
|
||||
method: call function: drop_partition
|
||||
expected: status not ok
|
||||
'''
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.drop_partition(collection, partition_tag='_default')
|
||||
except Exception as e:
|
||||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "DropPartition failed: default partition cannot be deleted"
|
||||
list_partition = connect.list_partitions(collection)
|
||||
assert '_default' in list_partition
|
||||
|
||||
def test_drop_default_partition_b(self, connect, collection):
|
||||
@pytest.mark.tags("0331")
|
||||
def test_drop_default_partition_B(self, connect, collection):
|
||||
'''
|
||||
target: test drop partition of default, check status returned
|
||||
method: call function: drop_partition
|
||||
expected: status not ok
|
||||
'''
|
||||
connect.create_partition(collection, default_tag)
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.drop_partition(collection, partition_tag='_default')
|
||||
except Exception as e:
|
||||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "DropPartition failed: default partition cannot be deleted"
|
||||
list_partition = connect.list_partitions(collection)
|
||||
assert '_default' in list_partition
|
||||
|
|
|
@ -24,7 +24,8 @@ default_dim = 128
|
|||
default_nb = 1200
|
||||
default_top_k = 10
|
||||
max_top_k = 16384
|
||||
max_partition_num = 256
|
||||
# max_partition_num = 256
|
||||
max_partition_num = 4096
|
||||
default_segment_row_limit = 1000
|
||||
default_server_segment_row_limit = 1024 * 512
|
||||
default_float_vec_field_name = "float_vector"
|
||||
|
|
Loading…
Reference in New Issue