mirror of https://github.com/milvus-io/milvus.git
[skip ci] Update check_items for ResponseChecker (#5649)
Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>pull/5656/head
parent
9d201b0b3f
commit
6530974932
|
@ -122,12 +122,12 @@ class TestcaseBase(Base):
|
|||
return collection_w
|
||||
|
||||
def init_partition_wrap(self, collection_wrap, name=None, description=None,
|
||||
negative=False, check_task=None, **kwargs):
|
||||
check_task=None, check_items=None, **kwargs):
|
||||
name = cf.gen_unique_str("partition_") if name is None else name
|
||||
description = cf.gen_unique_str("partition_des_") if description is None else description
|
||||
collection_wrap = self.init_collection_wrap() if collection_wrap is None else collection_wrap
|
||||
partition_wrap = ApiPartitionWrapper()
|
||||
partition_wrap.init_partition(collection_wrap.collection, name,
|
||||
description=description,
|
||||
check_task=check_task, **kwargs)
|
||||
partition_wrap.init_partition(collection_wrap.collection, name, description,
|
||||
check_task=check_task, check_items=check_items,
|
||||
**kwargs)
|
||||
return partition_wrap
|
||||
|
|
|
@ -9,97 +9,98 @@ from utils.api_request import api_request
|
|||
class ApiCollectionWrapper:
|
||||
collection = None
|
||||
|
||||
def init_collection(self, name, data=None, schema=None, check_task=None, check_params=None, **kwargs):
|
||||
def init_collection(self, name, data=None, schema=None, check_task=None, check_items=None, **kwargs):
|
||||
""" In order to distinguish the same name of collection """
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, is_succ = api_request([Collection, name, data, schema], **kwargs)
|
||||
self.collection = res if is_succ else None
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_params, is_succ, name=name, data=data, schema=schema, **kwargs).run()
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items, is_succ,
|
||||
name=name, data=data, schema=schema, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
@property
|
||||
def schema(self, check_res=None, check_params=None):
|
||||
def schema(self, check_task=None, check_items=None):
|
||||
return self.collection.schema
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.collection.schema])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
@property
|
||||
def description(self, check_res=None, check_params=None):
|
||||
def description(self, check_task=None, check_items=None):
|
||||
return self.collection.description
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.collection.description])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
@property
|
||||
def name(self, check_res=None, check_params=None):
|
||||
def name(self, check_task=None, check_items=None):
|
||||
return self.collection.name
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.collection.name])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
@property
|
||||
def is_empty(self, check_res=None, check_params=None):
|
||||
def is_empty(self, check_task=None, check_items=None):
|
||||
return self.collection.is_empty
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.collection.is_empty])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
@property
|
||||
def num_entities(self, check_res=None, check_params=None):
|
||||
def num_entities(self, check_task=None, check_items=None):
|
||||
return self.collection.num_entities
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.collection.num_entities])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
@property
|
||||
def primary_field(self, check_res=None, check_params=None):
|
||||
def primary_field(self, check_task=None, check_items=None):
|
||||
return self.collection.primary_field
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.collection.primary_field])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
def drop(self, check_res=None, check_params=None, **kwargs):
|
||||
def drop(self, check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = api_request([self.collection.drop], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, **kwargs).run()
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items, check, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def load(self, field_names=None, index_names=None, partition_names=None, check_res=None, check_params=None, **kwargs):
|
||||
def load(self, field_names=None, index_names=None, partition_names=None, check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = api_request([self.collection.load, field_names, index_names, partition_names], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, field_names=field_names, index_names=index_names,
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items, check, field_names=field_names, index_names=index_names,
|
||||
partition_names=partition_names, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def release(self, check_res=None, check_params=None, **kwargs):
|
||||
def release(self, check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = api_request([self.collection.release], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res,
|
||||
check_params, check, **kwargs).run()
|
||||
check_result = ResponseChecker(res, func_name, check_task,
|
||||
check_items, check, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def insert(self, data, partition_name=None, check_res=None, check_params=None, **kwargs):
|
||||
def insert(self, data, partition_name=None, check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = api_request([self.collection.insert, data, partition_name], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check,
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items, check,
|
||||
dat=data, partition_name=partition_name,
|
||||
**kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def search(self, data, anns_field, param, limit, expression,
|
||||
partition_names=None, output_fields=None, timeout=None,
|
||||
check_res=None, check_params=None, **kwargs):
|
||||
check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = api_request([self.collection.search, data, anns_field, param, limit, expression, partition_names,
|
||||
output_fields, timeout], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check,
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items, check,
|
||||
data=data, anns_field=anns_field, param=param, limit=limit,
|
||||
expression=expression, partition_names=partition_names,
|
||||
output_fields=output_fields,
|
||||
|
@ -107,62 +108,62 @@ class ApiCollectionWrapper:
|
|||
return res, check_result
|
||||
|
||||
@property
|
||||
def partitions(self, check_res=None, check_params=None):
|
||||
def partitions(self, check_task=None, check_items=None):
|
||||
return self.collection.partitions
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.collection.partitions])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
def partition(self, partition_name, check_task=None, check_params=None):
|
||||
def partition(self, partition_name, check_task=None, check_items=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, succ = api_request([self.collection.partition, partition_name])
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_params,
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items,
|
||||
succ, partition_name=partition_name).run()
|
||||
return res, check_result
|
||||
|
||||
def has_partition(self, partition_name, check_task=None, check_params=None):
|
||||
def has_partition(self, partition_name, check_task=None, check_items=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, succ = api_request([self.collection.has_partition, partition_name])
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_params,
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items,
|
||||
succ, partition_name=partition_name).run()
|
||||
return res, check_result
|
||||
|
||||
def drop_partition(self, partition_name, check_res=None, check_params=None, **kwargs):
|
||||
def drop_partition(self, partition_name, check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = api_request([self.collection.drop_partition, partition_name], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, partition_name=partition_name, **kwargs).run()
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items, check, partition_name=partition_name, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
@property
|
||||
def indexes(self, check_res=None, check_params=None):
|
||||
def indexes(self, check_task=None, check_items=None):
|
||||
return self.collection.indexes
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.collection.indexes])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
def index(self, index_name="", check_res=None, check_params=None):
|
||||
def index(self, index_name="", check_task=None, check_items=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = api_request([self.collection.index, index_name])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, index_name=index_name).run()
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items, check, index_name=index_name).run()
|
||||
return res, check_result
|
||||
|
||||
def create_index(self, field_name, index_params, index_name="", check_res=None, check_params=None, **kwargs):
|
||||
def create_index(self, field_name, index_params, index_name="", check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = api_request([self.collection.create_index, field_name, index_params, index_name], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, field_name=field_name, index_params=index_params,
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items, check, field_name=field_name, index_params=index_params,
|
||||
index_name=index_name, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def has_index(self, index_name="", check_res=None, check_params=None):
|
||||
def has_index(self, index_name="", check_task=None, check_items=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = api_request([self.collection.has_index, index_name])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, index_name=index_name).run()
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items, check, index_name=index_name).run()
|
||||
return res, check_result
|
||||
|
||||
def drop_index(self, index_name="", check_res=None, check_params=None, **kwargs):
|
||||
def drop_index(self, index_name="", check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = api_request([self.collection.drop_index, index_name], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, index_name=index_name, **kwargs).run()
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items, check, index_name=index_name, **kwargs).run()
|
||||
return res, check_result
|
||||
|
|
|
@ -10,87 +10,85 @@ class ApiPartitionWrapper:
|
|||
partition = None
|
||||
|
||||
def init_partition(self, collection, name, description="",
|
||||
check_task=None, check_params=None, **kwargs):
|
||||
check_task=None, check_items=None, **kwargs):
|
||||
""" In order to distinguish the same name of partition """
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
response, is_succ = api_request([Partition, collection, name, description], **kwargs)
|
||||
self.partition = response if is_succ is True else None
|
||||
check_result = ResponseChecker(response, func_name, check_task, check_params, is_succ,
|
||||
collection=collection, name=name, description=description,
|
||||
is_empty=True, num_entities=0,
|
||||
check_result = ResponseChecker(response, func_name, check_task, check_items, is_succ,
|
||||
**kwargs).run()
|
||||
return response, check_result
|
||||
|
||||
@property
|
||||
def description(self, check_res=None, check_params=None):
|
||||
def description(self, check_task=None, check_items=None):
|
||||
return self.partition.description if self.partition else None
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.partition.description])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
@property
|
||||
def name(self, check_res=None, check_params=None):
|
||||
def name(self, check_task=None, check_items=None):
|
||||
return self.partition.name if self.partition else None
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.partition.name])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
@property
|
||||
def is_empty(self, check_res=None, check_params=None):
|
||||
def is_empty(self, check_task=None, check_items=None):
|
||||
return self.partition.is_empty if self.partition else None
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.partition.is_empty])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
@property
|
||||
def num_entities(self, check_res=None, check_params=None):
|
||||
def num_entities(self, check_task=None, check_items=None):
|
||||
return self.partition.num_entities if self.partition else None
|
||||
# func_name = sys._getframe().f_code.co_name
|
||||
# res, check = func_req([self.partition.num_entities])
|
||||
# check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
# check_result = CheckFunc(res, func_name, check_task, check_items, check).run()
|
||||
# return res, check_result
|
||||
|
||||
def drop(self, check_task=None, check_params=None, **kwargs):
|
||||
def drop(self, check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, succ = api_request([self.partition.drop], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_params, succ, **kwargs).run()
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items, succ, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def load(self, field_names=None, index_names=None, check_task=None, check_params=None, **kwargs):
|
||||
def load(self, field_names=None, index_names=None, check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, succ = api_request([self.partition.load, field_names, index_names], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_task,
|
||||
check_params, is_succ=succ,
|
||||
check_items, is_succ=succ,
|
||||
field_names=field_names,
|
||||
index_names=index_names,
|
||||
**kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def release(self, check_task=None, check_params=None, **kwargs):
|
||||
def release(self, check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, succ = api_request([self.partition.release], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_task,
|
||||
check_params, is_succ=succ,
|
||||
check_items, is_succ=succ,
|
||||
**kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def insert(self, data, check_task=None, check_params=None, **kwargs):
|
||||
def insert(self, data, check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, succ = api_request([self.partition.insert, data], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_task,
|
||||
check_params, is_succ=succ, data=data,
|
||||
check_items, is_succ=succ, data=data,
|
||||
**kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def search(self, data, anns_field, params, limit, expr=None, output_fields=None,
|
||||
check_task=None, check_params=None, **kwargs):
|
||||
check_task=None, check_items=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, succ = api_request([self.partition.search, data, anns_field, params,
|
||||
limit, expr, output_fields], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_params,
|
||||
check_result = ResponseChecker(res, func_name, check_task, check_items,
|
||||
is_succ=succ, data=data, anns_field=anns_field,
|
||||
params=params, limit=limit, expr=expr,
|
||||
output_fields=output_fields, **kwargs).run()
|
||||
|
|
|
@ -6,14 +6,14 @@ from utils.api_request import Error
|
|||
|
||||
|
||||
class ResponseChecker:
|
||||
def __init__(self, response, func_name, check_task, check_params, is_succ=True, **kwargs):
|
||||
def __init__(self, response, func_name, check_task, check_items, is_succ=True, **kwargs):
|
||||
self.response = response # response of api request
|
||||
self.func_name = func_name # api function name
|
||||
self.check_task = check_task # task to check response of the api request
|
||||
self.check_items = check_params # check items and expectations that to be checked in check task
|
||||
self.check_items = check_items # check items and expectations that to be checked in check task
|
||||
self.succ = is_succ # api responses successful or not
|
||||
|
||||
self.kwargs_dict = {} # not used for now, just for extantion
|
||||
self.kwargs_dict = {} # not used for now, just for extension
|
||||
for key, value in kwargs.items():
|
||||
self.kwargs_dict[key] = value
|
||||
self.keys = self.kwargs_dict.keys()
|
||||
|
@ -33,10 +33,10 @@ class ResponseChecker:
|
|||
result = self.check_list_count(self.response, self.func_name, self.check_items)
|
||||
|
||||
elif self.check_task == CheckTasks.check_collection_property:
|
||||
result = self.check_collection_property(self.response, self.func_name, self.kwargs_dict)
|
||||
result = self.check_collection_property(self.response, self.func_name, self.check_items)
|
||||
|
||||
elif self.check_task == CheckTasks.check_partition_property:
|
||||
result = self.check_partition_property(self.response, self.func_name, self.kwargs_dict)
|
||||
result = self.check_partition_property(self.response, self.func_name, self.check_items)
|
||||
|
||||
# Add check_items here if something new need verify
|
||||
|
||||
|
@ -77,33 +77,33 @@ class ResponseChecker:
|
|||
return True
|
||||
|
||||
@staticmethod
|
||||
def check_collection_property(collection, func_name, params):
|
||||
def check_collection_property(collection, func_name, check_items):
|
||||
exp_func_name = "collection_init"
|
||||
if func_name != exp_func_name:
|
||||
log.warning("The function name is {} rather than {}".format(func_name, exp_func_name))
|
||||
if not isinstance(collection, Collection):
|
||||
raise Exception("The result to check isn't collection type object")
|
||||
assert collection.name == params["name"]
|
||||
assert collection.description == params["schema"].description
|
||||
assert collection.schema == params["schema"]
|
||||
assert collection.name == check_items["name"]
|
||||
assert collection.description == check_items["schema"].description
|
||||
assert collection.schema == check_items["schema"]
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def check_partition_property(partition, func_name, params):
|
||||
def check_partition_property(partition, func_name, check_items):
|
||||
exp_func_name = "_init_partition"
|
||||
if func_name != exp_func_name:
|
||||
log.warning("The function name is {} rather than {}".format(func_name, exp_func_name))
|
||||
if not isinstance(partition, Partition):
|
||||
raise Exception("The result to check isn't partition type object")
|
||||
if len(params) == 0:
|
||||
if len(check_items) == 0:
|
||||
raise Exception("No expect values found in the check task")
|
||||
if params["name"]:
|
||||
assert partition.name == params["name"]
|
||||
if params["description"]:
|
||||
assert partition.description == params["description"]
|
||||
if params["is_empty"]:
|
||||
assert partition.is_empty == params["is_empty"]
|
||||
if params["num_entities"]:
|
||||
assert partition.num_entities == params["num_entities"]
|
||||
if check_items["name"]:
|
||||
assert partition.name == check_items["name"]
|
||||
if check_items["description"]:
|
||||
assert partition.description == check_items["description"]
|
||||
if check_items["is_empty"]:
|
||||
assert partition.is_empty == check_items["is_empty"]
|
||||
if check_items["num_entities"]:
|
||||
assert partition.num_entities == check_items["num_entities"]
|
||||
return True
|
||||
|
||||
|
|
|
@ -28,7 +28,10 @@ class TestPartitionParams(TestcaseBase):
|
|||
# create partition
|
||||
self.init_partition_wrap(collection_w, partition_name,
|
||||
description=description,
|
||||
check_task=CheckTasks.check_partition_property)
|
||||
check_task=CheckTasks.check_partition_property,
|
||||
check_items={"name": partition_name, "description": description,
|
||||
"is_empty": True, "num_entities": 0}
|
||||
)
|
||||
|
||||
# check that the partition has been created
|
||||
assert collection_w.has_partition(partition_name)[0]
|
||||
|
@ -41,15 +44,13 @@ class TestPartitionParams(TestcaseBase):
|
|||
method: 1. create a partition empty none name
|
||||
expected: 1. raise exception
|
||||
"""
|
||||
self.collection_wrap.init_collection()
|
||||
|
||||
# create a collection
|
||||
collection_w = self.init_collection_wrap()
|
||||
|
||||
# create partition
|
||||
self.partition_wrap.init_partition(collection_w.collection, partition_name,
|
||||
check_task=CheckTasks.err_res,
|
||||
err_code=1, err_msg="Partition tag should not be empty")
|
||||
check_items={"err_code": 1, "err_msg": "Partition tag should not be empty"})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.parametrize("partition_name, description", [(cf.gen_unique_str(prefix), "")])
|
||||
|
@ -65,7 +66,10 @@ class TestPartitionParams(TestcaseBase):
|
|||
# init partition
|
||||
self.init_partition_wrap(collection_w, partition_name,
|
||||
description=description,
|
||||
check_task=CheckTasks.check_partition_property)
|
||||
check_task=CheckTasks.check_partition_property,
|
||||
check_items={"name": partition_name, "description": description,
|
||||
"is_empty": True, "num_entities": 0}
|
||||
)
|
||||
|
||||
# check that the partition has been created
|
||||
assert collection_w.has_partition(partition_name)[0]
|
||||
|
@ -107,7 +111,10 @@ class TestPartitionParams(TestcaseBase):
|
|||
# create partition
|
||||
self.init_partition_wrap(collection_w, partition_name,
|
||||
description=description,
|
||||
check_task=CheckTasks.check_partition_property)
|
||||
check_task=CheckTasks.check_partition_property,
|
||||
check_items={"name": partition_name, "description": description,
|
||||
"is_empty": True, "num_entities": 0}
|
||||
)
|
||||
assert collection_w.has_partition(partition_name)[0]
|
||||
assert collection_w.description == description
|
||||
|
||||
|
@ -147,7 +154,7 @@ class TestPartitionParams(TestcaseBase):
|
|||
# create partition
|
||||
self.partition_wrap.init_partition(self.collection_wrap.collection, partition_name,
|
||||
check_task=CheckTasks.err_res,
|
||||
check_params={'err_code':1, 'err_msg':"is illegal"}
|
||||
check_items={"err_code": 1, 'err_msg': "is illegal"}
|
||||
)
|
||||
# TODO: need an error code issue #5144 and assert independently
|
||||
|
||||
|
@ -162,7 +169,7 @@ class TestPartitionParams(TestcaseBase):
|
|||
# create partition with collection is None
|
||||
self.partition_wrap.init_partition(collection=None, name=partition_name,
|
||||
check_task=CheckTasks.err_res,
|
||||
err_code=1, err_msg="'NoneType' object has no attribute")
|
||||
check_items={"err_code": 1, "err_msg": "'NoneType' object has no attribute"})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
@pytest.mark.parametrize("partition_name", [cf.gen_unique_str(prefix)])
|
||||
|
@ -258,7 +265,9 @@ class TestPartitionParams(TestcaseBase):
|
|||
# create partition
|
||||
partition_w = self.init_partition_wrap(collection_w, partition_name,
|
||||
check_task=CheckTasks.check_partition_property,
|
||||
is_empty=True, num_entities=0)
|
||||
check_items={"name": partition_name,
|
||||
"is_empty": True, "num_entities": 0}
|
||||
)
|
||||
|
||||
# insert data
|
||||
partition_w.insert(data)
|
||||
|
@ -295,7 +304,7 @@ class TestPartitionOperations(TestcaseBase):
|
|||
# create partition failed
|
||||
self.partition_wrap.init_partition(collection_w.collection, partition_name,
|
||||
check_task=CheckTasks.err_res,
|
||||
err_code=1, err_msg="can't find collection")
|
||||
check_items={"err_code": 1, "err_msg": "can't find collection"})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L2)
|
||||
@pytest.mark.parametrize("partition_name", [cf.gen_unique_str(prefix)])
|
||||
|
@ -360,10 +369,11 @@ class TestPartitionOperations(TestcaseBase):
|
|||
for t in threads:
|
||||
t.join()
|
||||
p_name = cf.gen_unique_str()
|
||||
self.partition_wrap.init_partition(m_collection, p_name,
|
||||
check_task=CheckTasks.err_res,
|
||||
err_code=1,
|
||||
err_msg="maximum partition's number should be limit to 4096")
|
||||
self.partition_wrap.init_partition(
|
||||
m_collection, p_name,
|
||||
check_task=CheckTasks.err_res,
|
||||
check_items={"err_code": 1,
|
||||
"err_msg": "maximum partition's number should be limit to 4096"})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.xfail(reason="issue #5302")
|
||||
|
@ -381,7 +391,8 @@ class TestPartitionOperations(TestcaseBase):
|
|||
partition_w = collection_w.partition(ct.default_partition_name)
|
||||
|
||||
# verify that drop partition with error
|
||||
partition_w.drop(check_task=CheckTasks.err_res, err_code=1, err_msg="not")
|
||||
partition_w.drop(check_task=CheckTasks.err_res,
|
||||
check_items={"err_code": 1, "err_msg": "not"})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.parametrize("partition_name", [cf.gen_unique_str(prefix)])
|
||||
|
@ -405,7 +416,8 @@ class TestPartitionOperations(TestcaseBase):
|
|||
assert not collection_w.has_partition(partition_name)
|
||||
|
||||
# verify that drop the partition again with exception
|
||||
partition_w.drop(check_task=CheckTasks.err_res, err_code=1, err_msg="None Type")
|
||||
partition_w.drop(check_task=CheckTasks.err_res,
|
||||
check_items={"err_code": 1, "err_msg": "None Type"})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L2)
|
||||
@pytest.mark.parametrize("partition_name", [cf.gen_unique_str(prefix)])
|
||||
|
@ -529,7 +541,8 @@ class TestPartitionOperations(TestcaseBase):
|
|||
partition_w.drop()
|
||||
|
||||
# release the dropped partition and check err response
|
||||
partition_w.release(check_task=CheckTasks.err_res, err_code=1, err_msg="None Type")
|
||||
partition_w.release(check_task=CheckTasks.err_res,
|
||||
check_items={"err_code": 1, "err_msg": "None Type"})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.parametrize("partition_name", [cf.gen_unique_str(prefix)])
|
||||
|
@ -552,7 +565,8 @@ class TestPartitionOperations(TestcaseBase):
|
|||
collection_w.drop()
|
||||
|
||||
# release the partition and check err response
|
||||
partition_w.release(check_task=CheckTasks.err_res, err_code=1, err_msg="None Type")
|
||||
partition_w.release(check_task=CheckTasks.err_res,
|
||||
check_items={"err_code": 1, "err_msg": "None Type"})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.xfail(reason="issue #5384")
|
||||
|
@ -635,7 +649,8 @@ class TestPartitionOperations(TestcaseBase):
|
|||
|
||||
# insert data to partition
|
||||
partition_w.insert(cf.gen_default_dataframe_data(),
|
||||
check_task=CheckTasks.err_res, err_code=1, err_msg="not")
|
||||
check_task=CheckTasks.err_res,
|
||||
check_items={"err_code": 1, "err_msg": "not"})
|
||||
# TODO: update the assert error
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -658,8 +673,9 @@ class TestPartitionOperations(TestcaseBase):
|
|||
collection_w.drop()
|
||||
|
||||
# insert data to partition
|
||||
partition_w.insert(cf.gen_default_dataframe_data(), check_task=CheckTasks.err_res,
|
||||
err_code=1, err_msg="None Type")
|
||||
partition_w.insert(cf.gen_default_dataframe_data(),
|
||||
check_task=CheckTasks.err_res,
|
||||
check_items={"err_code": 1, "err_msg": "None Type"})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.xfail(reason="issue #5302")
|
||||
|
@ -695,7 +711,8 @@ class TestPartitionOperations(TestcaseBase):
|
|||
|
||||
data = cf.gen_default_list_data(nb=10, dim=dim)
|
||||
# insert data to partition
|
||||
partition_w.insert(data, check_task=CheckTasks.err_res, err_code=1, err_msg="blabla")
|
||||
partition_w.insert(data, check_task=CheckTasks.err_res,
|
||||
check_items={"err_code": 1, "err_msg": "blabla"})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.parametrize("sync", [True, False])
|
||||
|
|
Loading…
Reference in New Issue