mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 03:48:37 +08:00
Add 0331 tag
Signed-off-by: 紫晴 <ting.wang@zilliz.com>
This commit is contained in:
parent
531c82606a
commit
6df8aa8654
@ -82,8 +82,13 @@ class TestCreateCollection:
|
||||
# pdb.set_trace()
|
||||
connect.insert(collection, default_entity)
|
||||
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.create_collection(collection, default_fields)
|
||||
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 collection failed: collection %s exist" % collection
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_create_collection_after_insert_flush(self, connect, collection):
|
||||
@ -94,8 +99,13 @@ class TestCreateCollection:
|
||||
'''
|
||||
connect.insert(collection, default_entity)
|
||||
# connect.flush([collection])
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.create_collection(collection, default_fields)
|
||||
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 collection failed: collection %s exist" % collection
|
||||
|
||||
# TODO: assert exception
|
||||
@pytest.mark.tags("0331")
|
||||
@ -118,8 +128,13 @@ class TestCreateCollection:
|
||||
'''
|
||||
collection_name = gen_unique_str(uid)
|
||||
connect.create_collection(collection_name, default_fields)
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.create_collection(collection_name, default_fields)
|
||||
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 collection failed: collection %s exist" % collection_name
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_create_after_drop_collection(self, connect, collection):
|
||||
@ -229,17 +244,16 @@ class TestCreateCollectionInvalid(object):
|
||||
|
||||
@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:
|
||||
@pytest.mark.parametrize("collection_name", ('', None))
|
||||
def test_create_collection_with_empty_or_None_collection_name(self, connect, collection_name):
|
||||
# collection_name = ''
|
||||
try:
|
||||
connect.create_collection(collection_name, default_fields)
|
||||
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 == "Collection name should not be empty"
|
||||
|
||||
@pytest.mark.tags("0331")
|
||||
def test_create_collection_no_dimension(self, connect):
|
||||
@ -251,8 +265,13 @@ class TestCreateCollectionInvalid(object):
|
||||
collection_name = gen_unique_str(uid)
|
||||
fields = copy.deepcopy(default_fields)
|
||||
fields["fields"][-1]["params"].pop("dim")
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.create_collection(collection_name, fields)
|
||||
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 == "dimension is not defined in field type params"
|
||||
|
||||
def _test_create_collection_no_segment_row_limit(self, connect):
|
||||
'''
|
||||
@ -278,8 +297,14 @@ class TestCreateCollectionInvalid(object):
|
||||
field_name = gen_unique_str("field_name")
|
||||
field = {"name": field_name, "type": DataType.INT64}
|
||||
fields["fields"].append(field)
|
||||
with pytest.raises(Exception) as e:
|
||||
|
||||
try:
|
||||
connect.create_collection(collection_name, fields)
|
||||
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 == "maximum field's number should be limited to 64"
|
||||
|
||||
# TODO: assert exception
|
||||
@pytest.mark.level(2)
|
||||
|
@ -6,6 +6,7 @@ from constants import *
|
||||
|
||||
uid = "describe_collection"
|
||||
|
||||
|
||||
class TestDescribeCollection:
|
||||
|
||||
@pytest.fixture(
|
||||
@ -95,8 +96,13 @@ class TestDescribeCollection:
|
||||
connect.create_collection(collection_name, default_fields)
|
||||
connect.describe_collection(collection_name)
|
||||
connect.drop_collection(collection_name)
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.describe_collection(collection_name)
|
||||
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_name
|
||||
|
||||
@pytest.mark.level(2)
|
||||
@pytest.mark.tags("0331")
|
||||
@ -146,7 +152,7 @@ class TestDescribeCollection:
|
||||
res_ids = connect.insert(collection_name, entities)
|
||||
connect.flush([collection_name])
|
||||
res = connect.describe_collection(collection_name)
|
||||
assert res['auto_id'] == True
|
||||
assert res['auto_id'] is True
|
||||
# assert res['segment_row_limit'] == default_segment_row_limit
|
||||
assert len(res["fields"]) == 2
|
||||
for field in res["fields"]:
|
||||
@ -177,14 +183,7 @@ class TestDescribeCollectionInvalid(object):
|
||||
|
||||
@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
|
||||
@pytest.mark.parametrize("collection_name", ('', None))
|
||||
def test_describe_collection_with_empty_or_None_collection_name(self, connect, collection_name):
|
||||
with pytest.raises(Exception) as e:
|
||||
connect.describe_collection(collection_name)
|
||||
|
@ -10,6 +10,7 @@ from constants import *
|
||||
|
||||
uid = "drop_collection"
|
||||
|
||||
|
||||
class TestDropCollection:
|
||||
"""
|
||||
******************************************************************
|
||||
@ -17,7 +18,7 @@ class TestDropCollection:
|
||||
******************************************************************
|
||||
"""
|
||||
@pytest.mark.tags("0331")
|
||||
def test_drop_collection(self, connect, collection):
|
||||
def test_drop_collection_A(self, connect, collection):
|
||||
'''
|
||||
target: test delete collection created with correct params
|
||||
method: create collection and then delete,
|
||||
@ -47,8 +48,13 @@ class TestDropCollection:
|
||||
expected: False
|
||||
'''
|
||||
collection_name = gen_unique_str(uid)
|
||||
with pytest.raises(Exception) as e:
|
||||
try:
|
||||
connect.drop_collection(collection_name)
|
||||
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_name
|
||||
|
||||
@pytest.mark.level(2)
|
||||
@pytest.mark.tags("0331")
|
||||
@ -98,13 +104,7 @@ class TestDropCollectionInvalid(object):
|
||||
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
|
||||
@pytest.mark.parametrize("collection_name", ('', None))
|
||||
def test_drop_collection_with_empty_or_None_collection_name(self, connect, collection_name):
|
||||
with pytest.raises(Exception) as e:
|
||||
connect.has_collection(collection_name)
|
||||
|
@ -10,6 +10,7 @@ from constants import *
|
||||
|
||||
uid = "has_collection"
|
||||
|
||||
|
||||
class TestHasCollection:
|
||||
"""
|
||||
******************************************************************
|
||||
|
@ -157,6 +157,7 @@ class TestCreateBase:
|
||||
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.tags("fail")
|
||||
def test_create_partition_insert_same_tags(self, connect, id_collection):
|
||||
'''
|
||||
target: test create partition, and insert vectors, check status returned
|
||||
@ -174,6 +175,7 @@ class TestCreateBase:
|
||||
res = connect.get_collection_stats(id_collection)
|
||||
assert res["row_count"] == default_nb * 2
|
||||
|
||||
@pytest.mark.tags("fail")
|
||||
@pytest.mark.level(2)
|
||||
def test_create_partition_insert_same_tags_two_collections(self, connect, collection):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user