mirror of https://github.com/milvus-io/milvus.git
[skip ci] Refactor function names (#5621)
Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>pull/5642/head
parent
3434ad57e8
commit
a2ac3e040b
|
@ -5,10 +5,10 @@ import sys
|
|||
import threading
|
||||
from time import sleep
|
||||
|
||||
from base.client_request import ApiReq
|
||||
from base.client_base import TestcaseBase
|
||||
from pymilvus_orm import connections
|
||||
from checker import CreateChecker, SearchChecker, InsertChecker
|
||||
from base.client_request import ApiCollection
|
||||
from base.client_base import ApiCollectionWrapper
|
||||
from common import common_func as cf
|
||||
from common import common_type as ct
|
||||
from utils.util_log import test_log as log
|
||||
|
@ -21,7 +21,7 @@ class TestsChaos:
|
|||
res = connections.create_connection(alias='default')
|
||||
if res is None:
|
||||
raise Exception("no connections")
|
||||
c_wrapper = ApiCollection()
|
||||
c_wrapper = ApiCollectionWrapper()
|
||||
c_wrapper.collection_init(name=cf.gen_unique_str(),
|
||||
schema=cf.gen_default_collection_schema(),
|
||||
check_res="check_nothing")
|
||||
|
@ -33,7 +33,7 @@ class TestsChaos:
|
|||
res = connections.create_connection(alias='default')
|
||||
if res is None:
|
||||
raise Exception("no connections")
|
||||
c_wrapper = ApiCollection()
|
||||
c_wrapper = ApiCollectionWrapper()
|
||||
_, result = c_wrapper.collection_init(name=cf.gen_unique_str(),
|
||||
schema=cf.gen_default_collection_schema(),
|
||||
check_res="check_nothing")
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
from utils.util_log import test_log as log
|
||||
|
||||
|
||||
class Error:
|
||||
def __init__(self, error):
|
||||
self.code = getattr(error, 'code', 99999)
|
||||
self.message = getattr(error, 'message', str(error))
|
||||
|
||||
|
||||
def api_request_catch():
|
||||
def wrapper(func):
|
||||
def inner_wrapper(*args, **kwargs):
|
||||
try:
|
||||
res = func(*args, **kwargs)
|
||||
log.debug("(func_res) Response : %s " % str(res))
|
||||
return res, True
|
||||
except Exception as e:
|
||||
# log.info("exception: %s", e)
|
||||
log.error("[Partition API Exception]%s: %s" % (str(func), str(e)))
|
||||
return Error(e), False
|
||||
return inner_wrapper
|
||||
return wrapper
|
||||
|
||||
|
||||
@api_request_catch()
|
||||
def api_request(_list, **kwargs):
|
||||
if isinstance(_list, list):
|
||||
func = _list[0]
|
||||
if callable(func):
|
||||
arg = []
|
||||
if len(_list) > 1:
|
||||
for a in _list[1:]:
|
||||
arg.append(a)
|
||||
log.debug("(func_req)[%s] Parameters ars arg: %s, kwargs: %s" % (str(func), str(arg), str(kwargs)))
|
||||
return func(*arg, **kwargs)
|
||||
return False, False
|
|
@ -14,34 +14,6 @@ from common import common_func as cf
|
|||
from common import common_type as ct
|
||||
|
||||
|
||||
def request_catch():
|
||||
def wrapper(func):
|
||||
def inner_wrapper(*args, **kwargs):
|
||||
try:
|
||||
res = func(*args, **kwargs)
|
||||
log.debug("(func_res) Response : %s " % str(res))
|
||||
return res, True
|
||||
except Exception as e:
|
||||
log.error("[ClientRequest API Exception]%s: %s" % (str(func), str(e)))
|
||||
return e, False
|
||||
return inner_wrapper
|
||||
return wrapper
|
||||
|
||||
|
||||
@request_catch()
|
||||
def func_req(_list, **kwargs):
|
||||
if isinstance(_list, list):
|
||||
func = _list[0]
|
||||
if callable(func):
|
||||
arg = []
|
||||
if len(_list) > 1:
|
||||
for a in _list[1:]:
|
||||
arg.append(a)
|
||||
log.debug("(func_req)[%s] Parameters ars arg: %s, kwargs: %s" % (str(func), str(arg), str(kwargs)))
|
||||
return func(*arg, **kwargs)
|
||||
return False, False
|
||||
|
||||
|
||||
class ParamInfo:
|
||||
def __init__(self):
|
||||
self.param_host = ""
|
||||
|
@ -113,7 +85,7 @@ class Base:
|
|||
param_info.prepare_param_info(host, port, handler)
|
||||
|
||||
|
||||
class ApiReq(Base):
|
||||
class TestcaseBase(Base):
|
||||
"""
|
||||
Additional methods;
|
||||
Public methods that can be used to add cases.
|
||||
|
@ -130,7 +102,7 @@ class ApiReq(Base):
|
|||
def _connect(self):
|
||||
""" Add an connection and create the connect """
|
||||
self.connection_wrap.add_connection(default={"host": param_info.param_host, "port": param_info.param_port})
|
||||
res = self.connection_wrap.connect(alias='default')
|
||||
res, _ = self.connection_wrap.connect(alias='default')
|
||||
return res
|
||||
|
||||
def _collection(self, name=None, data=None, schema=None, check_res=None, c_object=None, **kwargs):
|
||||
|
@ -169,5 +141,4 @@ class ApiReq(Base):
|
|||
par = ApiPartitionWrapper()
|
||||
self.partition_mul += (par, )
|
||||
log.debug("[_partition_object_multiple] All objects of partition are : %s" % str(self.partition_mul))
|
||||
return self.partition_mul
|
||||
|
||||
return self.partition_mul
|
|
@ -8,34 +8,7 @@ from check.param_check import *
|
|||
from check.func_check import *
|
||||
from utils.util_log import test_log as log
|
||||
from common.common_type import *
|
||||
|
||||
|
||||
def collection_catch():
|
||||
def wrapper(func):
|
||||
def inner_wrapper(*args, **kwargs):
|
||||
try:
|
||||
res = func(*args, **kwargs)
|
||||
log.debug("(func_res) Response : %s " % str(res))
|
||||
return res, True
|
||||
except Exception as e:
|
||||
log.error("[Collection API Exception]%s: %s" % (str(func), str(e)))
|
||||
return e, False
|
||||
return inner_wrapper
|
||||
return wrapper
|
||||
|
||||
|
||||
@collection_catch()
|
||||
def func_req(_list, **kwargs):
|
||||
if isinstance(_list, list):
|
||||
func = _list[0]
|
||||
if callable(func):
|
||||
arg = []
|
||||
if len(_list) > 1:
|
||||
for a in _list[1:]:
|
||||
arg.append(a)
|
||||
# log.debug("(func_req)[%s] Parameters ars arg: %s, kwargs: %s" % (str(func), str(arg), str(kwargs)))
|
||||
return func(*arg, **kwargs)
|
||||
return False, False
|
||||
from base.api_request import api_request
|
||||
|
||||
|
||||
class ApiCollectionWrapper:
|
||||
|
@ -44,9 +17,9 @@ class ApiCollectionWrapper:
|
|||
def collection_init(self, name, data=None, schema=None, check_res=None, check_params=None, **kwargs):
|
||||
""" In order to distinguish the same name of collection """
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([Collection, name, data, schema], **kwargs)
|
||||
res, check = api_request([Collection, name, data, schema], **kwargs)
|
||||
self.collection = res if check is True else None
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, name=name, data=data, schema=schema, **kwargs).run()
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, name=name, data=data, schema=schema, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
@property
|
||||
|
@ -99,37 +72,43 @@ class ApiCollectionWrapper:
|
|||
|
||||
def drop(self, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.drop], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, **kwargs).run()
|
||||
res, check = api_request([self.collection.drop], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, 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):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.load, field_names, index_names, partition_names], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, field_names=field_names, index_names=index_names,
|
||||
partition_names=partition_names, **kwargs).run()
|
||||
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,
|
||||
partition_names=partition_names, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def release(self, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.release], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, **kwargs).run()
|
||||
res, check = api_request([self.collection.release], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res,
|
||||
check_params, check, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def insert(self, data, partition_name=None, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.insert, data, partition_name], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, data=data, partition_name=partition_name, **kwargs).run()
|
||||
res, check = api_request([self.collection.insert, data, partition_name], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, 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,
|
||||
def search(self, data, anns_field, param, limit, expression,
|
||||
partition_names=None, output_fields=None, timeout=None,
|
||||
check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.search, data, anns_field, param, limit, expression, partition_names,
|
||||
res, check = api_request([self.collection.search, data, anns_field, param, limit, expression, partition_names,
|
||||
output_fields, timeout], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, data=data, anns_field=anns_field, param=param, limit=limit,
|
||||
expression=expression, partition_names=partition_names, output_fields=output_fields,
|
||||
timeout=timeout, **kwargs).run()
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check,
|
||||
data=data, anns_field=anns_field, param=param, limit=limit,
|
||||
expression=expression, partition_names=partition_names,
|
||||
output_fields=output_fields,
|
||||
timeout=timeout, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
@property
|
||||
|
@ -142,20 +121,20 @@ class ApiCollectionWrapper:
|
|||
|
||||
def partition(self, partition_name, check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.partition, partition_name])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, partition_name=partition_name).run()
|
||||
res, check = api_request([self.collection.partition, partition_name])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, partition_name=partition_name).run()
|
||||
return res, check_result
|
||||
|
||||
def has_partition(self, partition_name, check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.has_partition, partition_name])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, partition_name=partition_name).run()
|
||||
res, check = api_request([self.collection.has_partition, partition_name])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, partition_name=partition_name).run()
|
||||
return res, check_result
|
||||
|
||||
def drop_partition(self, partition_name, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.drop_partition, partition_name], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, partition_name=partition_name, **kwargs).run()
|
||||
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()
|
||||
return res, check_result
|
||||
|
||||
@property
|
||||
|
@ -168,25 +147,25 @@ class ApiCollectionWrapper:
|
|||
|
||||
def index(self, index_name="", check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.index, index_name])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, index_name=index_name).run()
|
||||
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()
|
||||
return res, check_result
|
||||
|
||||
def create_index(self, field_name, index_params, index_name="", check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.create_index, field_name, index_params, index_name], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, field_name=field_name, index_params=index_params,
|
||||
index_name=index_name, **kwargs).run()
|
||||
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,
|
||||
index_name=index_name, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def has_index(self, index_name="", check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.has_index, index_name])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, index_name=index_name).run()
|
||||
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()
|
||||
return res, check_result
|
||||
|
||||
def drop_index(self, index_name="", check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.collection.drop_index, index_name], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, index_name=index_name, **kwargs).run()
|
||||
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()
|
||||
return res, check_result
|
||||
|
|
|
@ -6,36 +6,7 @@ import sys
|
|||
sys.path.append("..")
|
||||
from check.param_check import *
|
||||
from check.func_check import *
|
||||
from utils.util_log import test_log as log
|
||||
from common.common_type import *
|
||||
|
||||
|
||||
def connections_catch():
|
||||
def wrapper(func):
|
||||
def inner_wrapper(*args, **kwargs):
|
||||
try:
|
||||
res = func(*args, **kwargs)
|
||||
log.debug("(func_res) Response : %s " % str(res))
|
||||
return res, True
|
||||
except Exception as e:
|
||||
log.error("[Connections API Exception]%s: %s" % (str(func), str(e)))
|
||||
return e, False
|
||||
return inner_wrapper
|
||||
return wrapper
|
||||
|
||||
|
||||
@connections_catch()
|
||||
def func_req(_list, **kwargs):
|
||||
if isinstance(_list, list):
|
||||
func = _list[0]
|
||||
if callable(func):
|
||||
arg = []
|
||||
if len(_list) > 1:
|
||||
for a in _list[1:]:
|
||||
arg.append(a)
|
||||
log.debug("(func_req)[%s] Parameters ars arg: %s, kwargs: %s" % (str(func), str(arg), str(kwargs)))
|
||||
return func(*arg, **kwargs)
|
||||
return False, False
|
||||
from base.api_request import api_request
|
||||
|
||||
|
||||
class ApiConnectionsWrapper:
|
||||
|
@ -44,42 +15,42 @@ class ApiConnectionsWrapper:
|
|||
|
||||
def add_connection(self, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.connection.add_connection], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, **kwargs).run()
|
||||
res, check = api_request([self.connection.add_connection], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def disconnect(self, alias, check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.connection.disconnect, alias])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, alias=alias).run()
|
||||
res, check = api_request([self.connection.disconnect, alias])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, alias=alias).run()
|
||||
return res, check_result
|
||||
|
||||
def remove_connection(self, alias, check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.connection.remove_connection, alias])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, alias=alias).run()
|
||||
res, check = api_request([self.connection.remove_connection, alias])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, alias=alias).run()
|
||||
return res, check_result
|
||||
|
||||
def connect(self, alias=DefaultConfig.DEFAULT_USING, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.connection.connect, alias], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, alias=alias, **kwargs).run()
|
||||
res, check = api_request([self.connection.connect, alias], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, alias=alias, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def get_connection(self, alias=DefaultConfig.DEFAULT_USING, check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.connection.get_connection, alias])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, alias=alias).run()
|
||||
res, check = api_request([self.connection.get_connection, alias])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, alias=alias).run()
|
||||
return res, check_result
|
||||
|
||||
def list_connections(self, check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.connection.list_connections])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
res, check = api_request([self.connection.list_connections])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check).run()
|
||||
return res, check_result
|
||||
|
||||
def get_connection_addr(self, alias, check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.connection.get_connection_addr, alias])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, alias=alias).run()
|
||||
res, check = api_request([self.connection.get_connection_addr, alias])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, alias=alias).run()
|
||||
return res, check_result
|
||||
|
|
|
@ -1,41 +1,10 @@
|
|||
from pymilvus_orm import Index
|
||||
from pymilvus_orm.types import DataType
|
||||
from pymilvus_orm.default_config import DefaultConfig
|
||||
import sys
|
||||
from pymilvus_orm import Index
|
||||
|
||||
sys.path.append("..")
|
||||
from check.param_check import *
|
||||
from check.func_check import *
|
||||
from utils.util_log import test_log as log
|
||||
from common.common_type import *
|
||||
|
||||
|
||||
def index_catch():
|
||||
def wrapper(func):
|
||||
def inner_wrapper(*args, **kwargs):
|
||||
try:
|
||||
res = func(*args, **kwargs)
|
||||
log.debug("(func_res) Response : %s " % str(res))
|
||||
return res, True
|
||||
except Exception as e:
|
||||
log.error("[Index API Exception]%s: %s" % (str(func), str(e)))
|
||||
return e, False
|
||||
return inner_wrapper
|
||||
return wrapper
|
||||
|
||||
|
||||
@index_catch()
|
||||
def func_req(_list, **kwargs):
|
||||
if isinstance(_list, list):
|
||||
func = _list[0]
|
||||
if callable(func):
|
||||
arg = []
|
||||
if len(_list) > 1:
|
||||
for a in _list[1:]:
|
||||
arg.append(a)
|
||||
log.debug("(func_req)[%s] Parameters ars arg: %s, kwargs: %s" % (str(func), str(arg), str(kwargs)))
|
||||
return func(*arg, **kwargs)
|
||||
return False, False
|
||||
from base.api_request import api_request
|
||||
|
||||
|
||||
class ApiIndexWrapper:
|
||||
|
@ -44,38 +13,38 @@ class ApiIndexWrapper:
|
|||
def index_init(self, collection, field_name, index_params, name="", check_res=None, check_params=None, **kwargs):
|
||||
""" In order to distinguish the same name of index """
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([Index, collection, field_name, index_params, name], **kwargs)
|
||||
res, check = api_request([Index, collection, field_name, index_params, name], **kwargs)
|
||||
self.index = res if check is True else None
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, collection=collection, field_name=field_name,
|
||||
index_params=index_params, name=name, **kwargs).run()
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, collection=collection, field_name=field_name,
|
||||
index_params=index_params, name=name, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def name(self, check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.index.name])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
res, check = api_request([self.index.name])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check).run()
|
||||
return res, check_result
|
||||
|
||||
def params(self, check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.index.params])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
res, check = api_request([self.index.params])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check).run()
|
||||
return res, check_result
|
||||
|
||||
def collection_name(self, check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.index.collection_name])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
res, check = api_request([self.index.collection_name])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check).run()
|
||||
return res, check_result
|
||||
|
||||
def field_name(self, check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.index.field_name])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check).run()
|
||||
res, check = api_request([self.index.field_name])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check).run()
|
||||
return res, check_result
|
||||
|
||||
def drop(self, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.index.drop], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, **kwargs).run()
|
||||
res, check = api_request([self.index.drop], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, **kwargs).run()
|
||||
return res, check_result
|
||||
|
|
|
@ -6,43 +6,7 @@ import sys
|
|||
sys.path.append("..")
|
||||
from check.param_check import *
|
||||
from check.func_check import *
|
||||
from utils.util_log import test_log as log
|
||||
from common.common_type import *
|
||||
|
||||
|
||||
class Error:
|
||||
def __init__(self, error):
|
||||
self.code = getattr(error, 'code', 99999)
|
||||
self.message = getattr(error, 'message', str(error))
|
||||
|
||||
|
||||
def partition_catch():
|
||||
def wrapper(func):
|
||||
def inner_wrapper(*args, **kwargs):
|
||||
try:
|
||||
res = func(*args, **kwargs)
|
||||
log.debug("(func_res) Response : %s " % str(res))
|
||||
return res, True
|
||||
except Exception as e:
|
||||
# log.info("exception: %s", e)
|
||||
log.error("[Partition API Exception]%s: %s" % (str(func), str(e)))
|
||||
return Error(e), False
|
||||
return inner_wrapper
|
||||
return wrapper
|
||||
|
||||
|
||||
@partition_catch()
|
||||
def func_req(_list, **kwargs):
|
||||
if isinstance(_list, list):
|
||||
func = _list[0]
|
||||
if callable(func):
|
||||
arg = []
|
||||
if len(_list) > 1:
|
||||
for a in _list[1:]:
|
||||
arg.append(a)
|
||||
log.debug("(func_req)[%s] Parameters ars arg: %s, kwargs: %s" % (str(func), str(arg), str(kwargs)))
|
||||
return func(*arg, **kwargs)
|
||||
return False, False
|
||||
from base.api_request import api_request
|
||||
|
||||
|
||||
class ApiPartitionWrapper:
|
||||
|
@ -51,12 +15,12 @@ class ApiPartitionWrapper:
|
|||
def partition_init(self, collection, name, description="", check_res=None, check_params=None, **kwargs):
|
||||
""" In order to distinguish the same name of partition """
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([Partition, collection, name, description], **kwargs)
|
||||
res, check = api_request([Partition, collection, name, description], **kwargs)
|
||||
self.partition = res if check is True else None
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check,
|
||||
collection=collection, name=name, description=description,
|
||||
is_empty=True, num_entities=0,
|
||||
**kwargs).run()
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check,
|
||||
collection=collection, name=name, description=description,
|
||||
is_empty=True, num_entities=0,
|
||||
**kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
@property
|
||||
|
@ -93,32 +57,32 @@ class ApiPartitionWrapper:
|
|||
|
||||
def drop(self, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.partition.drop], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, **kwargs).run()
|
||||
res, check = api_request([self.partition.drop], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def load(self, field_names=None, index_names=None, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.partition.load, field_names, index_names], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, field_names=field_names, index_names=index_names,
|
||||
**kwargs).run()
|
||||
res, check = api_request([self.partition.load, field_names, index_names], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, field_names=field_names, index_names=index_names,
|
||||
**kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def release(self, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.partition.release], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, **kwargs).run()
|
||||
res, check = api_request([self.partition.release], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def insert(self, data, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.partition.insert, data], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, data=data, **kwargs).run()
|
||||
res, check = api_request([self.partition.insert, data], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, data=data, **kwargs).run()
|
||||
return res, check_result
|
||||
|
||||
def search(self, data, anns_field, params, limit, expr=None, output_fields=None, check_res=None, check_params=None, **kwargs):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.partition.search, data, anns_field, params, limit, expr, output_fields], **kwargs)
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, data=data, anns_field=anns_field, params=params,
|
||||
limit=limit, expr=expr, output_fields=output_fields, **kwargs).run()
|
||||
res, check = api_request([self.partition.search, data, anns_field, params, limit, expr, output_fields], **kwargs)
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, data=data, anns_field=anns_field, params=params,
|
||||
limit=limit, expr=expr, output_fields=output_fields, **kwargs).run()
|
||||
return res, check_result
|
||||
|
|
|
@ -8,34 +8,7 @@ from check.param_check import *
|
|||
from check.func_check import *
|
||||
from utils.util_log import test_log as log
|
||||
from common.common_type import *
|
||||
|
||||
|
||||
def utility_catch():
|
||||
def wrapper(func):
|
||||
def inner_wrapper(*args, **kwargs):
|
||||
try:
|
||||
res = func(*args, **kwargs)
|
||||
log.debug("(func_res) Response : %s " % str(res))
|
||||
return res, True
|
||||
except Exception as e:
|
||||
log.error("[Utility API Exception]%s: %s" % (str(func), str(e)))
|
||||
return e, False
|
||||
return inner_wrapper
|
||||
return wrapper
|
||||
|
||||
|
||||
@utility_catch()
|
||||
def func_req(_list, **kwargs):
|
||||
if isinstance(_list, list):
|
||||
func = _list[0]
|
||||
if callable(func):
|
||||
arg = []
|
||||
if len(_list) > 1:
|
||||
for a in _list[1:]:
|
||||
arg.append(a)
|
||||
log.debug("(func_req)[%s] Parameters ars arg: %s, kwargs: %s" % (str(func), str(arg), str(kwargs)))
|
||||
return func(*arg, **kwargs)
|
||||
return False, False
|
||||
from base.api_request import api_request
|
||||
|
||||
|
||||
class ApiUtilityWrapper:
|
||||
|
@ -45,47 +18,47 @@ class ApiUtilityWrapper:
|
|||
|
||||
def loading_progress(self, collection_name, partition_names=[], using="default", check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.ut.loading_progress, collection_name, partition_names, using])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, collection_name=collection_name,
|
||||
partition_names=partition_names,using=using).run()
|
||||
res, check = api_request([self.ut.loading_progress, collection_name, partition_names, using])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, collection_name=collection_name,
|
||||
partition_names=partition_names, using=using).run()
|
||||
return res, check_result
|
||||
|
||||
def wait_for_loading_complete(self, collection_name, partition_names=[], timeout=None, using="default", check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.ut.wait_for_loading_complete, collection_name, partition_names, timeout, using])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, collection_name=collection_name,
|
||||
partition_names=partition_names, timeout=timeout, using=using).run()
|
||||
res, check = api_request([self.ut.wait_for_loading_complete, collection_name, partition_names, timeout, using])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, collection_name=collection_name,
|
||||
partition_names=partition_names, timeout=timeout, using=using).run()
|
||||
return res, check_result
|
||||
|
||||
def index_building_progress(self, collection_name, index_name="", using="default", check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.ut.index_building_progress, collection_name, index_name, using])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, collection_name=collection_name, index_name=index_name,
|
||||
using=using).run()
|
||||
res, check = api_request([self.ut.index_building_progress, collection_name, index_name, using])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, collection_name=collection_name, index_name=index_name,
|
||||
using=using).run()
|
||||
return res, check_result
|
||||
|
||||
def wait_for_index_building_complete(self, collection_name, index_name="", timeout=None, using="default", check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.ut.wait_for_loading_complete, collection_name, index_name, timeout, using])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, collection_name=collection_name, index_name=index_name,
|
||||
timeout=timeout, using=using).run()
|
||||
res, check = api_request([self.ut.wait_for_loading_complete, collection_name, index_name, timeout, using])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, collection_name=collection_name, index_name=index_name,
|
||||
timeout=timeout, using=using).run()
|
||||
return res, check_result
|
||||
|
||||
def has_collection(self, collection_name, using="default", check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.ut.has_collection, collection_name, using])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, collection_name=collection_name, using=using).run()
|
||||
res, check = api_request([self.ut.has_collection, collection_name, using])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, collection_name=collection_name, using=using).run()
|
||||
return res, check_result
|
||||
|
||||
def has_partition(self, collection_name, partition_name, using="default", check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.ut.has_partition, collection_name, partition_name, using])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, collection_name=collection_name,
|
||||
partition_name=partition_name, using=using).run()
|
||||
res, check = api_request([self.ut.has_partition, collection_name, partition_name, using])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, collection_name=collection_name,
|
||||
partition_name=partition_name, using=using).run()
|
||||
return res, check_result
|
||||
|
||||
def list_collections(self, timeout=None, using="default", check_res=None, check_params=None):
|
||||
func_name = sys._getframe().f_code.co_name
|
||||
res, check = func_req([self.ut.list_collections, timeout, using])
|
||||
check_result = CheckFunc(res, func_name, check_res, check_params, check, timeout=timeout, using=using).run()
|
||||
res, check = api_request([self.ut.list_collections, timeout, using])
|
||||
check_result = ResponseChecker(res, func_name, check_res, check_params, check, timeout=timeout, using=using).run()
|
||||
return res, check_result
|
||||
|
|
|
@ -3,44 +3,47 @@ from common.common_type import *
|
|||
from pymilvus_orm import Collection, Partition
|
||||
|
||||
|
||||
class CheckFunc:
|
||||
def __init__(self, res, func_name, check_res, check_params, check_res_result=True, **kwargs):
|
||||
self.res = res # response of api request
|
||||
class ResponseChecker:
|
||||
def __init__(self, response, func_name, check_items, check_params, expect_succ=True, **kwargs):
|
||||
self.response = response # response of api request
|
||||
self.func_name = func_name
|
||||
self.check_res = check_res
|
||||
self.check_items = check_items
|
||||
self.check_params = check_params
|
||||
self.check_res_result = check_res_result
|
||||
self.params = {}
|
||||
self.expect_succ = expect_succ
|
||||
|
||||
# parse **kwargs. not used for now
|
||||
self.params = {}
|
||||
for key, value in kwargs.items():
|
||||
self.params[key] = value
|
||||
|
||||
self.keys = self.params.keys()
|
||||
|
||||
def run(self):
|
||||
# log.debug("[Run CheckFunc] Start checking res...")
|
||||
check_result = True
|
||||
"""
|
||||
Method: start response checking for milvus API call
|
||||
"""
|
||||
result = True
|
||||
if self.check_items is None:
|
||||
result = self.assert_expectation(self.expect_succ, True)
|
||||
|
||||
if self.check_res is None:
|
||||
check_result = self.check_response(self.check_res_result, True)
|
||||
elif self.check_items == CheckParams.err_res:
|
||||
result = self.assert_expectation(self.expect_succ, False)
|
||||
|
||||
elif self.check_res == CheckParams.err_res:
|
||||
check_result = self.check_response(self.check_res_result, False)
|
||||
elif self.check_items == CheckParams.list_count and self.check_params is not None:
|
||||
result = self.check_list_count(self.response, self.func_name, self.check_params)
|
||||
|
||||
elif self.check_res == CheckParams.list_count and self.check_params is not None:
|
||||
check_result = self.check_list_count(self.res, self.func_name, self.check_params)
|
||||
elif self.check_items == CheckParams.collection_property_check:
|
||||
result = self.req_collection_property_check(self.response, self.func_name, self.params)
|
||||
|
||||
elif self.check_res == CheckParams.collection_property_check:
|
||||
check_result = self.req_collection_property_check(self.res, self.func_name, self.params)
|
||||
elif self.check_items == CheckParams.partition_property_check:
|
||||
result = self.partition_property_check(self.response, self.func_name, self.params)
|
||||
|
||||
elif self.check_res == CheckParams.partition_property_check:
|
||||
check_result = self.partition_property_check(self.res, self.func_name, self.params)
|
||||
# Add check_items here if something new need verify
|
||||
|
||||
return check_result
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
def check_response(check_res_result, expect_result):
|
||||
assert check_res_result == expect_result
|
||||
def assert_expectation(expect, actual):
|
||||
assert actual == expect
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -3,11 +3,12 @@ import pytest
|
|||
from pymilvus import DataType
|
||||
from pymilvus_orm import FieldSchema
|
||||
|
||||
from base.client_request import ApiReq
|
||||
from base.client_base import TestcaseBase
|
||||
from utils.util_log import test_log as log
|
||||
from common import common_func as cf
|
||||
from common import common_type as ct
|
||||
from common.common_type import CaseLabel
|
||||
from common.common_type import CaseLabel, CheckParams
|
||||
|
||||
|
||||
prefix = "collection"
|
||||
default_schema = cf.gen_default_collection_schema()
|
||||
|
@ -28,12 +29,14 @@ def assert_default_collection(collection, exp_name=None, exp_schema=default_sche
|
|||
assert collection.primary_field == exp_primary
|
||||
|
||||
|
||||
class TestCollectionParams(ApiReq):
|
||||
class TestCollectionParams(TestcaseBase):
|
||||
""" Test case of collection interface """
|
||||
|
||||
'''
|
||||
def teardown_method(self):
|
||||
if self.collection_wrap is not None and self.collection_wrap.collection is not None:
|
||||
self.collection_wrap.drop()
|
||||
'''
|
||||
|
||||
def setup_method(self):
|
||||
pass
|
||||
|
@ -73,7 +76,7 @@ class TestCollectionParams(ApiReq):
|
|||
c_name = cf.gen_unique_str(prefix)
|
||||
collection, _ = self.collection_wrap.collection_init(c_name, data=None, schema=default_schema)
|
||||
assert_default_collection(collection, c_name)
|
||||
assert c_name in self.utility_wrap.list_collections()[0]
|
||||
assert c_name, _ in self.utility_wrap.list_collections()[0]
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
def test_collection_empty_name(self):
|
||||
|
@ -84,7 +87,8 @@ class TestCollectionParams(ApiReq):
|
|||
"""
|
||||
self._connect()
|
||||
c_name = ""
|
||||
ex, check = self.collection_wrap.collection_init(c_name, schema=default_schema)
|
||||
ex, check = self.collection_wrap.collection_init(c_name, schema=default_schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "value is illegal" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -96,7 +100,9 @@ class TestCollectionParams(ApiReq):
|
|||
"""
|
||||
self._connect()
|
||||
c_name = get_invalid_string
|
||||
ex, check = self.collection_wrap.collection_init(c_name, schema=default_schema)
|
||||
ex, check = self.collection_wrap.collection_init(c_name, schema=default_schema,
|
||||
check_res=CheckParams.err_res)
|
||||
|
||||
assert "invalid" or "illegal" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
|
@ -114,7 +120,7 @@ class TestCollectionParams(ApiReq):
|
|||
assert collection.name == dup_collection.name
|
||||
assert collection.schema == dup_collection.schema
|
||||
assert collection.num_entities == dup_collection.num_entities
|
||||
assert collection.name in self.utility_wrap.list_collections()[0]
|
||||
assert collection.name, _ in self.utility_wrap.list_collections()[0]
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
def test_collection_dup_name_with_desc(self):
|
||||
|
@ -146,7 +152,8 @@ class TestCollectionParams(ApiReq):
|
|||
assert_default_collection(collection)
|
||||
fields = [cf.gen_int64_field()]
|
||||
schema = cf.gen_collection_schema(fields=fields)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "The collection already exist, but the schema isnot the same as the passed in" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -162,7 +169,8 @@ class TestCollectionParams(ApiReq):
|
|||
c_name = collection.name
|
||||
assert_default_collection(collection)
|
||||
schema = cf.gen_default_collection_schema(primary_field=ct.default_int64_field_name)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "The collection already exist, but the schema isnot the same as the passed in" in str(ex)
|
||||
assert collection.primary_field is None
|
||||
|
||||
|
@ -181,7 +189,8 @@ class TestCollectionParams(ApiReq):
|
|||
schema = cf.gen_default_collection_schema()
|
||||
new_fields = cf.gen_float_vec_field(dim=new_dim)
|
||||
schema.fields[-1] = new_fields
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "The collection already exist, but the schema isnot the same as the passed in" in str(ex)
|
||||
assert collection.primary_field is None
|
||||
|
||||
|
@ -196,7 +205,8 @@ class TestCollectionParams(ApiReq):
|
|||
collection = self._collection()
|
||||
c_name = collection.name
|
||||
assert_default_collection(collection)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=get_invalid_type_schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=get_invalid_type_schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "schema type must be schema.CollectionSchema" in str(ex)
|
||||
assert_default_collection(collection, c_name)
|
||||
|
||||
|
@ -215,6 +225,7 @@ class TestCollectionParams(ApiReq):
|
|||
assert_default_collection(dup_collection, c_name)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.xfail(reason="issue #5367")
|
||||
def test_collection_dup_name_none_schema_dataframe(self):
|
||||
"""
|
||||
target: test collection with dup name and insert dataframe
|
||||
|
@ -259,7 +270,8 @@ class TestCollectionParams(ApiReq):
|
|||
"""
|
||||
self._connect()
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=None)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=None,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "Collection missing schema" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
|
@ -271,7 +283,8 @@ class TestCollectionParams(ApiReq):
|
|||
"""
|
||||
self._connect()
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=get_invalid_type_schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=get_invalid_type_schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "schema type must be schema.CollectionSchema" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -308,7 +321,8 @@ class TestCollectionParams(ApiReq):
|
|||
c_name = cf.gen_unique_str(prefix)
|
||||
field = FieldSchema(name=get_invalid_string, dtype=5)
|
||||
schema = cf.gen_collection_schema(fields=[field])
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
message_one = "but expected one of: bytes, unicode"
|
||||
message_two = "You should specify the name of field"
|
||||
message_three = "Invalid field name"
|
||||
|
@ -337,7 +351,8 @@ class TestCollectionParams(ApiReq):
|
|||
field = FieldSchema(name=ct.default_int64_field_name, dtype=5.0)
|
||||
vec_field = cf.gen_float_vec_field()
|
||||
schema = cf.gen_collection_schema(fields=[field, vec_field])
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "Field type must be of DataType" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
|
@ -350,7 +365,8 @@ class TestCollectionParams(ApiReq):
|
|||
self._connect()
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
schema = cf.gen_collection_schema(fields=[])
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "The field of the schema cannot be empty" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -365,7 +381,8 @@ class TestCollectionParams(ApiReq):
|
|||
field_one = cf.gen_int64_field()
|
||||
field_two = cf.gen_int64_field()
|
||||
schema = cf.gen_collection_schema(fields=[field_one, field_two])
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "duplicated field name" in str(ex)
|
||||
has, _ = self.utility_wrap.has_collection(c_name)
|
||||
assert not has
|
||||
|
@ -422,7 +439,8 @@ class TestCollectionParams(ApiReq):
|
|||
self._connect()
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
schema = cf.gen_collection_schema([cf.gen_int64_field()])
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "The schema must have vector column" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
|
@ -450,7 +468,8 @@ class TestCollectionParams(ApiReq):
|
|||
field = get_unsupported_primary_field
|
||||
vec_field = cf.gen_float_vec_field()
|
||||
schema = cf.gen_collection_schema(fields=[field, vec_field], primary_field=field.name)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "the data type of primary key should be int64" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -465,7 +484,8 @@ class TestCollectionParams(ApiReq):
|
|||
int_field = cf.gen_int64_field(is_primary=True)
|
||||
float_vec_field = cf.gen_float_vec_field(is_primary=True)
|
||||
schema = cf.gen_collection_schema(fields=[int_field, float_vec_field])
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "there are more than one primary key" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -480,7 +500,8 @@ class TestCollectionParams(ApiReq):
|
|||
int_field = cf.gen_int64_field(name="int", is_primary=True)
|
||||
float_vec_field = cf.gen_float_vec_field(name="vec")
|
||||
schema = cf.gen_collection_schema(fields=[int_field, float_vec_field], primary_field="vec")
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "there are more than one primary key" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -507,6 +528,13 @@ class TestCollectionParams(ApiReq):
|
|||
expected: raise exception
|
||||
"""
|
||||
self._connect()
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
int_field = cf.gen_int64_field(name="int", is_primary=get_invalid_string)
|
||||
float_vec_field = cf.gen_float_vec_field()
|
||||
schema = cf.gen_collection_schema(fields=[int_field, float_vec_field])
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
log.info(str(ex))
|
||||
cf.gen_unique_str(prefix)
|
||||
with pytest.raises(Exception, match="Param is_primary must be bool type"):
|
||||
cf.gen_int64_field(name="int", is_primary=get_invalid_string)
|
||||
|
@ -523,7 +551,8 @@ class TestCollectionParams(ApiReq):
|
|||
c_name = cf.gen_unique_str(prefix)
|
||||
float_vec_field = FieldSchema(name="vec", dtype=dtype)
|
||||
schema = cf.gen_collection_schema(fields=[float_vec_field])
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "dimension is not defined in field type params" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -537,7 +566,8 @@ class TestCollectionParams(ApiReq):
|
|||
c_name = cf.gen_unique_str(prefix)
|
||||
float_vec_field = cf.gen_float_vec_field(dim=get_invalid_dim)
|
||||
schema = cf.gen_collection_schema(fields=[float_vec_field])
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "dim must be of int" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -552,7 +582,8 @@ class TestCollectionParams(ApiReq):
|
|||
c_name = cf.gen_unique_str(prefix)
|
||||
float_vec_field = cf.gen_float_vec_field(dim=dim)
|
||||
schema = cf.gen_collection_schema(fields=[float_vec_field])
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "invalid dimension: {}. should be in range 1 ~ 32768".format(dim) in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -653,8 +684,12 @@ class TestCollectionParams(ApiReq):
|
|||
nb = ct.default_nb
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
data = cf.gen_default_binary_dataframe_data(3)
|
||||
collection, _ = self.collection_wrap.collection_init(c_name, schema=default_binary_schema, data=data)
|
||||
assert_default_collection(collection, c_name, exp_schema=default_binary_schema, exp_num=nb)
|
||||
collection, _ = self.collection_wrap.collection_init(c_name,
|
||||
schema=default_binary_schema,
|
||||
data=data)
|
||||
assert_default_collection(collection, c_name,
|
||||
exp_schema=default_binary_schema,
|
||||
exp_num=nb)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
@pytest.mark.xfail(reason="issue #5414")
|
||||
|
@ -668,11 +703,13 @@ class TestCollectionParams(ApiReq):
|
|||
nb = ct.default_nb
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
data = cf.gen_default_binary_list_data(nb)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=default_binary_schema, data=data)
|
||||
ex, _ = self.collection_wrap.collection_init(c_name, schema=default_binary_schema,
|
||||
data=data,
|
||||
check_res=CheckParams.err_res)
|
||||
log.debug(str(ex))
|
||||
|
||||
|
||||
class TestCollectionOperation(ApiReq):
|
||||
class TestCollectionOperation(TestcaseBase):
|
||||
"""
|
||||
******************************************************************
|
||||
The following cases are used to test collection interface operations
|
||||
|
@ -708,7 +745,8 @@ class TestCollectionOperation(ApiReq):
|
|||
self.connection_wrap.remove_connection(ct.default_alias)
|
||||
res_list = self.connection_wrap.list_connections()
|
||||
assert ct.default_alias not in res_list
|
||||
ex, check = self.collection_wrap.collection_init(c_name, schema=default_schema)
|
||||
ex, check = self.collection_wrap.collection_init(c_name, schema=default_schema,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "There is no connection with alias '{}'".format(ct.default_alias) in str(ex)
|
||||
assert self.collection_wrap.collection is None
|
||||
|
||||
|
@ -742,7 +780,7 @@ class TestCollectionOperation(ApiReq):
|
|||
dup_collection, _ = self.collection_wrap.collection_init(collection.name)
|
||||
assert_default_collection(dup_collection, collection.name)
|
||||
dup_collection.drop()
|
||||
has, _ = self.utility_wrap.has_collection(collection.name)
|
||||
has, _ = self.utility_wrap.has_collection(collection.name, check_res=CheckParams.err_res)
|
||||
assert not has
|
||||
with pytest.raises(Exception, match="can't find collection"):
|
||||
collection.num_entities
|
||||
|
@ -773,7 +811,9 @@ class TestCollectionOperation(ApiReq):
|
|||
self._connect()
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
data = pd.DataFrame()
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None, data=data)
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None,
|
||||
data=data,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "The field of the schema cannot be empty" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -785,7 +825,9 @@ class TestCollectionOperation(ApiReq):
|
|||
"""
|
||||
self._connect()
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None, data=get_invalid_df)
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None,
|
||||
data=get_invalid_df,
|
||||
check_res=CheckParams.err_res)
|
||||
message_one = "Cannot infer schema from empty dataframe"
|
||||
message_two = "Field name should not be empty"
|
||||
message_three = "Invalid field name"
|
||||
|
@ -803,7 +845,9 @@ class TestCollectionOperation(ApiReq):
|
|||
# one field different type df
|
||||
mix_data = [(1, 2., [0.1, 0.2]), (2, 3., 4)]
|
||||
df = pd.DataFrame(data=mix_data, columns=list("ABC"))
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None, data=df)
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None,
|
||||
data=df,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "The data in the same column must be of the same type" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
|
@ -815,7 +859,9 @@ class TestCollectionOperation(ApiReq):
|
|||
"""
|
||||
self._connect()
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None, data=get_non_df)
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None,
|
||||
data=get_non_df,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "Data of not pandas.DataFrame type should bepassed into the schema" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
|
@ -828,7 +874,9 @@ class TestCollectionOperation(ApiReq):
|
|||
self._connect()
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
data = cf.gen_default_list_data(nb=100)
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None, data=data)
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None,
|
||||
data=data,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "Data of not pandas.DataFrame type should bepassed into the schema" in str(ex)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -873,5 +921,6 @@ class TestCollectionOperation(ApiReq):
|
|||
self._connect()
|
||||
c_name = cf.gen_unique_str(prefix)
|
||||
data = cf.gen_default_binary_list_data(nb=100)
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None, data=data)
|
||||
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None, data=data,
|
||||
check_res=CheckParams.err_res)
|
||||
assert "Data of not pandas.DataFrame type should bepassed into the schema" in str(ex)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import pytest
|
||||
|
||||
from pymilvus_orm.default_config import DefaultConfig
|
||||
from base.client_request import ApiReq
|
||||
from base.client_base import TestcaseBase
|
||||
from utils.util_log import test_log as log
|
||||
from common.common_type import *
|
||||
|
||||
|
||||
class TestConnectionParams(ApiReq):
|
||||
class TestConnectionParams(TestcaseBase):
|
||||
"""
|
||||
Test case of connections interface
|
||||
The author : Ting.Wang
|
||||
|
@ -87,7 +87,7 @@ class TestConnectionParams(ApiReq):
|
|||
log.info(res[0])
|
||||
|
||||
|
||||
class TestConnectionOperation(ApiReq):
|
||||
class TestConnectionOperation(TestcaseBase):
|
||||
"""
|
||||
Test case of connections interface
|
||||
The author : Ting.Wang
|
||||
|
|
|
@ -2,7 +2,7 @@ import copy
|
|||
import pytest
|
||||
from pymilvus_orm import FieldSchema
|
||||
|
||||
from base.client_request import ApiReq
|
||||
from base.client_base import TestcaseBase
|
||||
from base.index_wrapper import ApiIndexWrapper
|
||||
from base.collection_wrapper import ApiCollectionWrapper
|
||||
from utils.util_log import test_log as log
|
||||
|
@ -16,7 +16,7 @@ default_field_name = ct.default_float_vec_field_name
|
|||
default_index_params = {"index_type": "IVF_SQ8", "metric_type": "L2", "params": {"nlist": 64}}
|
||||
|
||||
|
||||
class TestIndexParams(ApiReq):
|
||||
class TestIndexParams(TestcaseBase):
|
||||
""" Test case of index interface """
|
||||
|
||||
@pytest.fixture(
|
||||
|
@ -174,7 +174,7 @@ class TestIndexParams(ApiReq):
|
|||
assert "invalid" or "illegal" in str(ex)
|
||||
|
||||
|
||||
class TestIndexBase(ApiReq):
|
||||
class TestIndexBase(TestcaseBase):
|
||||
""" Test case of index interface """
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -319,7 +319,7 @@ class TestIndexBase(ApiReq):
|
|||
assert "error" in ex
|
||||
|
||||
|
||||
class TestIndexAdvanced(ApiReq):
|
||||
class TestIndexAdvanced(TestcaseBase):
|
||||
""" Test case of index interface """
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L2)
|
||||
|
|
|
@ -4,7 +4,7 @@ import numpy as np
|
|||
import pandas as pd
|
||||
import pytest
|
||||
|
||||
from base.client_request import ApiReq
|
||||
from base.client_base import TestcaseBase
|
||||
from utils.util_log import test_log as log
|
||||
from common import common_func as cf
|
||||
from common import common_type as ct
|
||||
|
@ -15,7 +15,7 @@ default_schema = cf.gen_default_collection_schema()
|
|||
default_binary_schema = cf.gen_default_binary_collection_schema()
|
||||
|
||||
|
||||
class TestInsertParams(ApiReq):
|
||||
class TestInsertParams(TestcaseBase):
|
||||
""" Test case of Insert interface """
|
||||
|
||||
def teardown_method(self):
|
||||
|
@ -375,7 +375,7 @@ class TestInsertParams(ApiReq):
|
|||
assert "The types of schema and data do not match" in str(ex)
|
||||
|
||||
|
||||
class TestInsertOperation(ApiReq):
|
||||
class TestInsertOperation(TestcaseBase):
|
||||
"""
|
||||
******************************************************************
|
||||
The following cases are used to test insert interface operations
|
||||
|
@ -521,7 +521,7 @@ class TestInsertOperation(ApiReq):
|
|||
assert collection.num_entities == ct.default_nb
|
||||
|
||||
|
||||
class TestInsertAsync(ApiReq):
|
||||
class TestInsertAsync(TestcaseBase):
|
||||
"""
|
||||
******************************************************************
|
||||
The following cases are used to test insert async
|
||||
|
|
|
@ -3,11 +3,11 @@ from milvus import DataType
|
|||
|
||||
from common.common_type import *
|
||||
from common.common_func import *
|
||||
from base.client_request import ApiReq
|
||||
from base.client_base import TestcaseBase
|
||||
from utils.util_log import test_log as log
|
||||
|
||||
|
||||
class TestParams(ApiReq):
|
||||
class TestParams(TestcaseBase):
|
||||
def test_1(self):
|
||||
self.connection.configure(check_res='', default={"host": "192.168.1.240", "port": "19530"})
|
||||
res_ = self.connection.get_connection(alias='default')
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import threading
|
||||
import pytest
|
||||
from base.partition import ApiPartitionWrapper
|
||||
|
||||
from pymilvus_orm import Partition
|
||||
from base.client_request import ApiReq
|
||||
from base.client_base import TestcaseBase
|
||||
from utils.util_log import test_log as log
|
||||
from common import common_func as cf
|
||||
from common import common_type as ct
|
||||
|
@ -12,7 +11,7 @@ from common.common_type import CaseLabel, CheckParams
|
|||
prefix = "partition_"
|
||||
|
||||
|
||||
class TestPartitionParams(ApiReq):
|
||||
class TestPartitionParams(TestcaseBase):
|
||||
""" Test case of partition interface in parameters"""
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
|
@ -284,7 +283,7 @@ class TestPartitionParams(ApiReq):
|
|||
assert self.partition_wrap.num_entities == (nums + nums)
|
||||
|
||||
|
||||
class TestPartitionOperations(ApiReq):
|
||||
class TestPartitionOperations(TestcaseBase):
|
||||
""" Test case of partition interface in operations """
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -377,7 +376,8 @@ class TestPartitionOperations(ApiReq):
|
|||
for t in threads:
|
||||
t.join()
|
||||
p_name = cf.gen_unique_str()
|
||||
ex, _ = self.partition_wrap.partition_init(m_collection, p_name)
|
||||
ex, _ = self.partition_wrap.partition_init(m_collection, p_name,
|
||||
check_res=CheckParams.err_res)
|
||||
assert ex.code == 1
|
||||
assert "maximum partition's number should be limit to 4096" in ex.message
|
||||
|
||||
|
@ -640,29 +640,6 @@ class TestPartitionOperations(ApiReq):
|
|||
self.partition_wrap.release()
|
||||
# TODO assert release successfully
|
||||
|
||||
# m_collection = self._collection()
|
||||
# p_name = cf.gen_unique_str(prefix)
|
||||
# m_partition, _ = self.partition_wrap.partition_init(m_collection, p_name)
|
||||
# assert m_collection.has_partition(p_name)
|
||||
# m_partition.insert(cf.gen_default_list_data())
|
||||
# m_partition.load()
|
||||
# search_vec = cf.gen_vectors(1, ct.default_dim)
|
||||
# result = m_partition.search(data=search_vec,
|
||||
# anns_field=ct.default_float_vec_field_name,
|
||||
# params={"nprobe": 32},
|
||||
# limit=1
|
||||
# )
|
||||
# assert len(result) == 1
|
||||
# m_collection.release()
|
||||
# result = m_partition.search(data=search_vec,
|
||||
# anns_field=ct.default_float_vec_field_name,
|
||||
# params={"nprobe": 32},
|
||||
# limit=1
|
||||
# )
|
||||
# assert len(result) == 0
|
||||
# m_partition.release()
|
||||
# # TODO assert release successfully
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.xfail(reason="issue #5302")
|
||||
@pytest.mark.parametrize("partition_name, data", [(ct.default_partition_name, cf.gen_default_dataframe_data())])
|
||||
|
@ -733,7 +710,7 @@ class TestPartitionOperations(ApiReq):
|
|||
log.error(res)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
# @pytest.mark.xfail(reason="issue #5302")
|
||||
@pytest.mark.xfail(reason="issue #5302")
|
||||
def test_partition_insert_maximum_size_data(self, data):
|
||||
"""
|
||||
target: verify insert maximum size data(256M?) a time
|
||||
|
@ -751,6 +728,7 @@ class TestPartitionOperations(ApiReq):
|
|||
# insert data to partition
|
||||
max_size = 100000 # TODO: clarify the max size of data
|
||||
self.partition_wrap.insert(cf.gen_default_dataframe_data(max_size))
|
||||
# TODO: need a flush for #5302
|
||||
assert self.partition_wrap.num_entities == max_size
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import pytest
|
||||
from base.client_request import ApiReq
|
||||
from base.client_base import TestcaseBase
|
||||
from utils.util_log import test_log as log
|
||||
from common.common_type import *
|
||||
|
||||
|
||||
class TestSchema(ApiReq):
|
||||
class TestSchema(TestcaseBase):
|
||||
""" Test case of schema interface """
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L3)
|
||||
|
|
|
@ -4,7 +4,7 @@ import pytest
|
|||
import random
|
||||
import numpy as np
|
||||
|
||||
from base.client_request import ApiReq
|
||||
from base.client_base import TestcaseBase
|
||||
from utils.util_log import test_log as log
|
||||
from common import common_func as cf
|
||||
from common import common_type as ct
|
||||
|
@ -21,15 +21,16 @@ default_search_params = ct.default_search_params
|
|||
epsilon = ct.epsilon
|
||||
CaseLabel = ct.CaseLabel
|
||||
|
||||
class TestCollectionSearch(ApiReq):
|
||||
""" Test case of collection search interface """
|
||||
|
||||
class TestCollectionSearch(TestcaseBase):
|
||||
""" Test case of search interface """
|
||||
|
||||
def init_data(self, insert_data=False, nb=3000, partition_num=0, multiple=False, is_binary=False):
|
||||
'''
|
||||
"""
|
||||
target: initialize before search
|
||||
method: create connection and collection
|
||||
expected: return collection
|
||||
'''
|
||||
"""
|
||||
log.info("Test case of search interface: initialize before test case")
|
||||
if not multiple:
|
||||
self.clear_env()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import copy
|
||||
import pytest
|
||||
from pymilvus_orm import FieldSchema
|
||||
from base.client_request import ApiReq
|
||||
from base.client_base import TestcaseBase
|
||||
from base.collection_wrapper import ApiCollectionWrapper
|
||||
from base.partition_wrapper import ApiPartitionWrapper
|
||||
from base.index_wrapper import ApiIndexWrapper
|
||||
|
@ -17,7 +17,7 @@ default_field_name = ct.default_float_vec_field_name
|
|||
default_index_params = {"index_type": "IVF_SQ8", "metric_type": "L2", "params": {"nlist": 64}}
|
||||
|
||||
|
||||
class TestUtilityParams(ApiReq):
|
||||
class TestUtilityParams(TestcaseBase):
|
||||
""" Test case of index interface """
|
||||
|
||||
@pytest.fixture(
|
||||
|
@ -152,7 +152,7 @@ class TestUtilityParams(ApiReq):
|
|||
assert "invalid" or "illegal" in str(ex)
|
||||
|
||||
|
||||
class TestUtilityBase(ApiReq):
|
||||
class TestUtilityBase(TestcaseBase):
|
||||
""" Test case of index interface """
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -446,7 +446,7 @@ class TestUtilityBase(ApiReq):
|
|||
assert res["num_indexed_entities"] == nb
|
||||
|
||||
|
||||
class TestUtilityAdvanced(ApiReq):
|
||||
class TestUtilityAdvanced(TestcaseBase):
|
||||
""" Test case of index interface """
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L2)
|
||||
|
|
Loading…
Reference in New Issue