Add tag 0331 for collection testcases

Signed-off-by: Cai Yudong <yudong.cai@zilliz.com>
This commit is contained in:
Cai Yudong 2021-03-01 18:25:15 +08:00 committed by yefu.chen
parent 235979996c
commit f9bf04119e
5 changed files with 50 additions and 11 deletions

View File

@ -40,6 +40,7 @@ class TestCreateCollection:
def get_segment_row_limit(self, request):
yield request.param
@pytest.mark.tags("0331")
def test_create_collection_fields(self, connect, get_filter_field, get_vector_field):
'''
target: test create normal collection with different fields
@ -71,6 +72,7 @@ class TestCreateCollection:
connect.create_collection(collection_name, fields)
assert connect.has_collection(collection_name)
@pytest.mark.tags("0331")
def test_create_collection_after_insert(self, connect, collection):
'''
target: test insert vector, then create collection again
@ -83,6 +85,7 @@ class TestCreateCollection:
with pytest.raises(Exception) as e:
connect.create_collection(collection, default_fields)
@pytest.mark.tags("0331")
def test_create_collection_after_insert_flush(self, connect, collection):
'''
target: test insert vector, then create collection again
@ -95,6 +98,7 @@ class TestCreateCollection:
connect.create_collection(collection, default_fields)
# TODO: assert exception
@pytest.mark.tags("0331")
def test_create_collection_without_connection(self, dis_connect):
'''
target: test create collection, without connection
@ -105,6 +109,7 @@ class TestCreateCollection:
with pytest.raises(Exception) as e:
dis_connect.create_collection(collection_name, default_fields)
@pytest.mark.tags("0331")
def test_create_collection_existed(self, connect):
'''
target: test create collection but the collection name have already existed
@ -116,6 +121,7 @@ class TestCreateCollection:
with pytest.raises(Exception) as e:
connect.create_collection(collection_name, default_fields)
@pytest.mark.tags("0331")
def test_create_after_drop_collection(self, connect, collection):
'''
target: create with the same collection name after collection dropped
@ -127,6 +133,7 @@ class TestCreateCollection:
connect.create_collection(collection, default_fields)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_create_collection_multithread(self, connect):
'''
target: test create collection with multithread
@ -203,6 +210,7 @@ class TestCreateCollectionInvalid(object):
connect.create_collection(collection_name, fields)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_create_collection_with_invalid_dimension(self, connect, get_dim):
dimension = get_dim
collection_name = gen_unique_str()
@ -212,23 +220,27 @@ class TestCreateCollectionInvalid(object):
connect.create_collection(collection_name, fields)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_create_collection_with_invalid_collection_name(self, connect, get_invalid_string):
collection_name = get_invalid_string
with pytest.raises(Exception) as e:
connect.create_collection(collection_name, default_fields)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_create_collection_with_empty_collection_name(self, connect):
collection_name = ''
with pytest.raises(Exception) as e:
connect.create_collection(collection_name, default_fields)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_create_collection_with_none_collection_name(self, connect):
collection_name = None
with pytest.raises(Exception) as e:
connect.create_collection(collection_name, default_fields)
@pytest.mark.tags("0331")
def test_create_collection_no_dimension(self, connect):
'''
target: test create collection with no dimension params
@ -257,6 +269,7 @@ class TestCreateCollectionInvalid(object):
assert res["segment_row_limit"] == default_server_segment_row_limit
# TODO: assert exception
@pytest.mark.tags("0331")
def test_create_collection_limit_fields(self, connect):
collection_name = gen_unique_str(uid)
limit_num = 64
@ -270,6 +283,7 @@ class TestCreateCollectionInvalid(object):
# TODO: assert exception
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_create_collection_invalid_field_name(self, connect, get_invalid_string):
collection_name = gen_unique_str(uid)
fields = copy.deepcopy(default_fields)
@ -280,6 +294,7 @@ class TestCreateCollectionInvalid(object):
connect.create_collection(collection_name, fields)
# TODO: assert exception
@pytest.mark.tags("0331")
def test_create_collection_invalid_field_type(self, connect, get_field_type):
collection_name = gen_unique_str(uid)
fields = copy.deepcopy(default_fields)

View File

@ -38,7 +38,7 @@ class TestDescribeCollection:
The following cases are used to test `describe_collection` function, no data in collection
******************************************************************
"""
@pytest.mark.tags("0331")
def test_collection_fields(self, connect, get_filter_field, get_vector_field):
'''
target: test create normal collection with different fields, check info returned
@ -64,17 +64,16 @@ class TestDescribeCollection:
assert field["name"] == vector_field["name"]
assert field["params"] == vector_field["params"]
@pytest.mark.tags("0331")
def test_describe_collection_after_index_created(self, connect, collection, get_simple_index):
connect.create_index(collection, default_float_vec_field_name, get_simple_index)
res = connect.describe_collection(collection)
logging.getLogger().info(res)
for field in res["fields"]:
if field["name"] == default_float_vec_field_name:
index = field["indexes"][0]
assert index["index_type"] == get_simple_index["index_type"]
assert index["metric_type"] == get_simple_index["metric_type"]
index = connect.describe_index(collection, default_float_vec_field_name)
assert index["index_type"] == get_simple_index["index_type"]
assert index["metric_type"] == get_simple_index["metric_type"]
assert index["params"] == get_simple_index["params"]
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_describe_collection_without_connection(self, collection, dis_connect):
'''
target: test get collection info, without connection
@ -84,6 +83,7 @@ class TestDescribeCollection:
with pytest.raises(Exception) as e:
dis_connect.describe_collection(collection)
@pytest.mark.tags("0331")
def test_describe_collection_not_existed(self, connect):
'''
target: test if collection not created
@ -99,6 +99,7 @@ class TestDescribeCollection:
connect.describe_collection(collection_name)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_describe_collection_multithread(self, connect):
'''
target: test create collection with multithread
@ -126,7 +127,7 @@ class TestDescribeCollection:
The following cases are used to test `describe_collection` function, and insert data in collection
******************************************************************
"""
@pytest.mark.tags("0331")
def test_describe_collection_fields_after_insert(self, connect, get_filter_field, get_vector_field):
'''
target: test create normal collection with different fields, check info returned
@ -156,7 +157,6 @@ class TestDescribeCollection:
assert field["params"] == vector_field["params"]
class TestDescribeCollectionInvalid(object):
"""
Test describe collection with invalid params
@ -169,18 +169,21 @@ class TestDescribeCollectionInvalid(object):
yield request.param
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_describe_collection_with_invalid_collection_name(self, connect, get_collection_name):
collection_name = get_collection_name
with pytest.raises(Exception) as e:
connect.describe_collection(collection_name)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_describe_collection_with_empty_collection_name(self, connect):
collection_name = ''
with pytest.raises(Exception) as e:
connect.describe_collection(collection_name)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_describe_collection_with_none_collection_name(self, connect):
collection_name = None
with pytest.raises(Exception) as e:

View File

@ -16,6 +16,7 @@ class TestDropCollection:
The following cases are used to test `drop_collection` function
******************************************************************
"""
@pytest.mark.tags("0331")
def test_drop_collection(self, connect, collection):
'''
target: test delete collection created with correct params
@ -27,6 +28,7 @@ class TestDropCollection:
time.sleep(2)
assert not connect.has_collection(collection)
@pytest.mark.tags("0331")
def test_drop_collection_without_connection(self, collection, dis_connect):
'''
target: test describe collection, without connection
@ -36,6 +38,7 @@ class TestDropCollection:
with pytest.raises(Exception) as e:
dis_connect.drop_collection(collection)
@pytest.mark.tags("0331")
def test_drop_collection_not_existed(self, connect):
'''
target: test if collection not created
@ -48,6 +51,7 @@ class TestDropCollection:
connect.drop_collection(collection_name)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_create_drop_collection_multithread(self, connect):
'''
target: test create and drop collection with multithread
@ -87,16 +91,19 @@ class TestDropCollectionInvalid(object):
yield request.param
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_drop_collection_with_invalid_collection_name(self, connect, get_collection_name):
collection_name = get_collection_name
with pytest.raises(Exception) as e:
connect.has_collection(collection_name)
@pytest.mark.tags("0331")
def test_drop_collection_with_empty_collection_name(self, connect):
collection_name = ''
with pytest.raises(Exception) as e:
connect.has_collection(collection_name)
@pytest.mark.tags("0331")
def test_drop_collection_with_none_collection_name(self, connect):
collection_name = None
with pytest.raises(Exception) as e:

View File

@ -16,6 +16,7 @@ class TestHasCollection:
The following cases are used to test `has_collection` function
******************************************************************
"""
@pytest.mark.tags("0331")
def test_has_collection(self, connect, collection):
'''
target: test if the created collection existed
@ -25,6 +26,7 @@ class TestHasCollection:
assert connect.has_collection(collection)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_has_collection_without_connection(self, collection, dis_connect):
'''
target: test has collection, without connection
@ -34,6 +36,7 @@ class TestHasCollection:
with pytest.raises(Exception) as e:
assert dis_connect.has_collection(collection)
@pytest.mark.tags("0331")
def test_has_collection_not_existed(self, connect):
'''
target: test if collection not created
@ -48,6 +51,7 @@ class TestHasCollection:
assert not connect.has_collection(collection_name)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_has_collection_multithread(self, connect):
'''
target: test create collection with multithread
@ -83,19 +87,23 @@ class TestHasCollectionInvalid(object):
yield request.param
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_has_collection_with_invalid_collection_name(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)
@pytest.mark.tags("0331")
def test_has_collection_with_empty_collection_name(self, connect):
collection_name = ''
with pytest.raises(Exception) as e:
connect.has_collection(collection_name)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_has_collection_with_none_collection_name(self, connect):
collection_name = None
with pytest.raises(Exception) as e:
connect.has_collection(collection_name)

View File

@ -12,7 +12,7 @@ class TestListCollections:
The following cases are used to test `list_collections` function
******************************************************************
"""
@pytest.mark.tags("0331")
def test_list_collections(self, connect, collection):
'''
target: test list collections
@ -21,6 +21,7 @@ class TestListCollections:
'''
assert collection in connect.list_collections()
@pytest.mark.tags("0331")
def test_list_collections_multi_collections(self, connect):
'''
target: test list collections
@ -34,6 +35,7 @@ class TestListCollections:
assert collection_name in connect.list_collections()
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_list_collections_without_connection(self, dis_connect):
'''
target: test list collections, without connection
@ -43,6 +45,7 @@ class TestListCollections:
with pytest.raises(Exception) as e:
dis_connect.list_collections()
@pytest.mark.tags("0331")
def test_list_collections_not_existed(self, connect):
'''
target: test if collection not created
@ -58,6 +61,7 @@ class TestListCollections:
# TODO: make sure to run this case in the end
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_list_collections_no_collection(self, connect):
'''
target: test show collections is correct or not, if no collection in db
@ -71,6 +75,7 @@ class TestListCollections:
assert connect.has_collection(collection_name)
@pytest.mark.level(2)
@pytest.mark.tags("0331")
def test_list_collections_multithread(self, connect):
'''
target: test list collection with multithread
@ -92,3 +97,4 @@ class TestListCollections:
time.sleep(0.2)
for t in threads:
t.join()