未验证 提交 fb358af0 编写于 作者: Y yanliang567 提交者: GitHub

[skip ci] Update the name to init_collection (#5643)

Signed-off-by: Nyanliang567 <yanliang.qiao@zilliz.com>
上级 6e9a4e36
......@@ -71,7 +71,7 @@ class CreateChecker(Checker):
def keep_creating(self):
while self._running is True:
collection, result = self.c_wrapper.collection_init(name=cf.gen_unique_str(),
collection, result = self.c_wrapper.init_collection(name=cf.gen_unique_str(),
schema=cf.gen_default_collection_schema(),
check_task="check_nothing")
if result is True:
......
......@@ -22,7 +22,7 @@ class TestsChaos:
if res is None:
raise Exception("no connections")
c_wrapper = ApiCollectionWrapper()
c_wrapper.collection_init(name=cf.gen_unique_str(),
c_wrapper.init_collection(name=cf.gen_unique_str(),
schema=cf.gen_default_collection_schema(),
check_task="check_nothing")
return c_wrapper
......@@ -34,7 +34,7 @@ class TestsChaos:
if res is None:
raise Exception("no connections")
c_wrapper = ApiCollectionWrapper()
_, result = c_wrapper.collection_init(name=cf.gen_unique_str(),
_, result = c_wrapper.init_collection(name=cf.gen_unique_str(),
schema=cf.gen_default_collection_schema(),
check_task="check_nothing")
if result is False:
......
......@@ -100,15 +100,16 @@ class TestcaseBase(Base):
self.connection_wrap.add_connection(default={"host": param_info.param_host, "port": param_info.param_port})
res, _ = self.connection_wrap.connect(alias='default')
return res
'''
def _collection(self, **kwargs):
""" Init a collection and return the object of collection """
name = cf.gen_unique_str()
schema = cf.gen_default_collection_schema()
if self.connection_wrap.get_connection(alias='default') is None:
self._connect()
res, cr = self.collection_wrap.collection_init(name=name, schema=schema, **kwargs)
res, cr = self.collection_wrap.init_collection(name=name, schema=schema, **kwargs)
return res
'''
def init_collection_wrap(self, name=None, data=None, schema=None, check_task=None, **kwargs):
name = cf.gen_unique_str('coll_') if name is None else name
......@@ -116,7 +117,7 @@ class TestcaseBase(Base):
if self.connection_wrap.get_connection(alias='default')[0] is None:
self._connect()
collection_w = ApiCollectionWrapper()
collection_w.collection_init(name=name, data=data, schema=schema,
collection_w.init_collection(name=name, data=data, schema=schema,
check_task=check_task, **kwargs)
return collection_w
......
......@@ -9,7 +9,7 @@ from utils.api_request import api_request
class ApiCollectionWrapper:
collection = None
def collection_init(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_params=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)
......
......@@ -336,7 +336,7 @@ class TestIndexAdvanced(TestcaseBase):
collection = self._collection(c_name)
api_collection_2 = ApiCollectionWrapper()
api_index_2 = ApiIndexWrapper()
collection_2 = api_collection_2.collection_init(c_name_2)
collection_2 = api_collection_2.init_collection(c_name_2)
self.index_wrap.index_init(collection, default_field_name, default_index_params, name=index_name)
index_2, _ = api_index_2.index_init(collection_2, default_field_name, default_index_params, name=index_name)
self.index_wrap.drop()
......
......@@ -41,7 +41,7 @@ class TestPartitionParams(TestcaseBase):
method: 1. create a partition empty none name
expected: 1. raise exception
"""
self.collection_wrap.collection_init()
self.collection_wrap.init_collection()
# create a collection
collection_w = self.init_collection_wrap()
......
......@@ -42,7 +42,7 @@ class TestCollectionSearch(TestcaseBase):
default_schema = cf.gen_default_collection_schema()
else:
default_schema = cf.gen_default_binary_collection_schema()
collection, _ = self.collection_wrap.collection_init(default_collection_name,
collection, _ = self.collection_wrap.init_collection(default_collection_name,
data=None, schema=default_schema)
# 2 add extra partition if specified (default is 1 partition named "_default")
if partition_num > 0:
......@@ -126,7 +126,7 @@ class TestCollectionSearch(TestcaseBase):
res_list, _ = self.utility_wrap.list_collections()
count = 0
for res in res_list:
collection, _ = self.collection_wrap.collection_init(name=res)
collection, _ = self.collection_wrap.init_collection(name=res)
if "search_collection" in res:
self.clear_data(collection)
count = count + 1
......
......@@ -462,7 +462,7 @@ class TestUtilityAdvanced(TestcaseBase):
c_name_2 = cf.gen_unique_str(prefix)
self._collection(c_name)
api_c = ApiCollectionWrapper()
api_c.collection_init(c_name_2)
api_c.init_collection(c_name_2)
for name in [c_name, c_name_2]:
res, _ = ut.has_collection(name)
assert res is True
......@@ -480,7 +480,7 @@ class TestUtilityAdvanced(TestcaseBase):
c_name_2 = cf.gen_unique_str(prefix)
self._collection(c_name)
api_c = ApiCollectionWrapper()
api_c.collection_init(c_name_2)
api_c.init_collection(c_name_2)
res, _ = ut.list_collections()
for name in [c_name, c_name_2]:
assert name in res
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册