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

Signed-off-by: yanliang567 <yanliang.qiao@zilliz.com>
pull/5645/head
yanliang567 2021-06-07 14:14:37 +08:00 committed by GitHub
parent 6e9a4e366e
commit fb358af098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 63 additions and 62 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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

View File

@ -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)

View File

@ -74,7 +74,7 @@ class TestCollectionParams(TestcaseBase):
"""
self._connect()
c_name = cf.gen_unique_str(prefix)
collection, _ = self.collection_wrap.collection_init(c_name, data=None, schema=default_schema)
collection, _ = self.collection_wrap.init_collection(c_name, data=None, schema=default_schema)
assert_default_collection(collection, c_name)
assert c_name, _ in self.utility_wrap.list_collections()[0]
@ -87,7 +87,7 @@ class TestCollectionParams(TestcaseBase):
"""
self._connect()
c_name = ""
ex, check = self.collection_wrap.collection_init(c_name, schema=default_schema,
ex, check = self.collection_wrap.init_collection(c_name, schema=default_schema,
check_task=CheckTasks.err_res)
assert "value is illegal" in str(ex)
@ -100,7 +100,7 @@ class TestCollectionParams(TestcaseBase):
"""
self._connect()
c_name = get_invalid_string
ex, check = self.collection_wrap.collection_init(c_name, schema=default_schema,
ex, check = self.collection_wrap.init_collection(c_name, schema=default_schema,
check_task=CheckTasks.err_res)
assert "invalid" or "illegal" in str(ex)
@ -116,7 +116,7 @@ class TestCollectionParams(TestcaseBase):
collection = self._collection()
c_name = collection.name
assert_default_collection(collection)
dup_collection, _ = self.collection_wrap.collection_init(c_name)
dup_collection, _ = self.collection_wrap.init_collection(c_name)
assert collection.name == dup_collection.name
assert collection.schema == dup_collection.schema
assert collection.num_entities == dup_collection.num_entities
@ -134,7 +134,7 @@ class TestCollectionParams(TestcaseBase):
collection = self._collection(schema=schema)
assert_default_collection(collection, exp_schema=schema)
c_name = collection.name
dup_collection, _ = self.collection_wrap.collection_init(c_name)
dup_collection, _ = self.collection_wrap.init_collection(c_name)
assert_default_collection(dup_collection, c_name, exp_schema=schema)
assert collection.description == dup_collection.description
@ -152,7 +152,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
assert "The collection already exist, but the schema isnot the same as the passed in" in str(ex)
@ -169,7 +169,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.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
@ -189,7 +189,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.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
@ -205,7 +205,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=get_invalid_type_schema,
check_task=CheckTasks.err_res)
assert "schema type must be schema.CollectionSchema" in str(ex)
assert_default_collection(collection, c_name)
@ -221,7 +221,7 @@ class TestCollectionParams(TestcaseBase):
collection = self._collection(schema=default_schema)
c_name = collection.name
assert_default_collection(collection)
dup_collection, _ = self.collection_wrap.collection_init(c_name, schema=default_schema)
dup_collection, _ = self.collection_wrap.init_collection(c_name, schema=default_schema)
assert_default_collection(dup_collection, c_name)
@pytest.mark.tags(CaseLabel.L1)
@ -238,7 +238,7 @@ class TestCollectionParams(TestcaseBase):
c_name = collection.name
assert_default_collection(collection)
df = cf.gen_default_dataframe_data(nb)
dup_collection, _ = self.collection_wrap.collection_init(c_name, schema=None, data=df)
dup_collection, _ = self.collection_wrap.init_collection(c_name, schema=None, data=df)
conn.flush([c_name])
assert_default_collection(dup_collection, c_name, exp_num=nb)
assert collection.num_entities == nb
@ -256,7 +256,7 @@ class TestCollectionParams(TestcaseBase):
c_name = collection.name
assert_default_collection(collection)
data = cf.gen_default_dataframe_data(nb)
dup_collection, _ = self.collection_wrap.collection_init(c_name, schema=None, data=data)
dup_collection, _ = self.collection_wrap.init_collection(c_name, schema=None, data=data)
conn.flush([c_name])
assert_default_collection(dup_collection, c_name, exp_num=nb)
assert collection.num_entities == nb
@ -270,7 +270,7 @@ class TestCollectionParams(TestcaseBase):
"""
self._connect()
c_name = cf.gen_unique_str(prefix)
ex, _ = self.collection_wrap.collection_init(c_name, schema=None,
ex, _ = self.collection_wrap.init_collection(c_name, schema=None,
check_task=CheckTasks.err_res)
assert "Collection missing schema" in str(ex)
@ -283,7 +283,7 @@ class TestCollectionParams(TestcaseBase):
"""
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.init_collection(c_name, schema=get_invalid_type_schema,
check_task=CheckTasks.err_res)
assert "schema type must be schema.CollectionSchema" in str(ex)
@ -321,7 +321,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
message_one = "but expected one of: bytes, unicode"
message_two = "You should specify the name of field"
@ -351,7 +351,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
assert "Field type must be of DataType" in str(ex)
@ -365,7 +365,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
assert "The field of the schema cannot be empty" in str(ex)
@ -381,7 +381,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
assert "duplicated field name" in str(ex)
has, _ = self.utility_wrap.has_collection(c_name)
@ -398,7 +398,7 @@ class TestCollectionParams(TestcaseBase):
self._connect()
c_name = cf.gen_unique_str(prefix)
schema = cf.gen_collection_schema(fields=[field])
collection, _ = self.collection_wrap.collection_init(c_name, schema=schema)
collection, _ = self.collection_wrap.init_collection(c_name, schema=schema)
assert_default_collection(collection, c_name, exp_schema=schema)
@pytest.mark.tags(CaseLabel.L1)
@ -412,7 +412,7 @@ class TestCollectionParams(TestcaseBase):
c_name = cf.gen_unique_str(prefix)
fields = [cf.gen_float_vec_field(), cf.gen_float_vec_field(name="tmp")]
schema = cf.gen_collection_schema(fields=fields)
collection, _ = self.collection_wrap.collection_init(c_name, schema=schema)
collection, _ = self.collection_wrap.init_collection(c_name, schema=schema)
assert_default_collection(collection, c_name, exp_schema=schema)
@pytest.mark.tags(CaseLabel.L1)
@ -426,7 +426,7 @@ class TestCollectionParams(TestcaseBase):
c_name = cf.gen_unique_str(prefix)
fields = [cf.gen_float_vec_field(), cf.gen_binary_vec_field()]
schema = cf.gen_collection_schema(fields=fields)
collection, _ = self.collection_wrap.collection_init(c_name, schema=schema)
collection, _ = self.collection_wrap.init_collection(c_name, schema=schema)
assert_default_collection(collection, c_name, exp_schema=schema)
@pytest.mark.tags(CaseLabel.L0)
@ -439,7 +439,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
assert "The schema must have vector column" in str(ex)
@ -453,7 +453,7 @@ class TestCollectionParams(TestcaseBase):
self._connect()
c_name = cf.gen_unique_str(prefix)
schema = cf.gen_default_collection_schema(primary_field=ct.default_int64_field_name)
collection, _ = self.collection_wrap.collection_init(c_name, schema=schema)
collection, _ = self.collection_wrap.init_collection(c_name, schema=schema)
assert collection.primary_field.name == ct.default_int64_field_name
@pytest.mark.tags(CaseLabel.L1)
@ -468,7 +468,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
assert "the data type of primary key should be int64" in str(ex)
@ -484,7 +484,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
assert "there are more than one primary key" in str(ex)
@ -500,7 +500,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
assert "there are more than one primary key" in str(ex)
@ -516,7 +516,7 @@ class TestCollectionParams(TestcaseBase):
int_field = cf.gen_int64_field(name="int")
float_vec_field = cf.gen_float_vec_field()
schema = cf.gen_collection_schema(fields=[int_field, float_vec_field])
collection, _ = self.collection_wrap.collection_init(c_name, schema=schema)
collection, _ = self.collection_wrap.init_collection(c_name, schema=schema)
assert collection.primary_field is None
assert collection.schema.auto_id
@ -532,7 +532,7 @@ class TestCollectionParams(TestcaseBase):
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,
ex, _ = self.collection_wrap.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
log.info(str(ex))
cf.gen_unique_str(prefix)
@ -551,7 +551,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
assert "dimension is not defined in field type params" in str(ex)
@ -566,7 +566,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
assert "dim must be of int" in str(ex)
@ -582,7 +582,7 @@ class TestCollectionParams(TestcaseBase):
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.init_collection(c_name, schema=schema,
check_task=CheckTasks.err_res)
assert "invalid dimension: {}. should be in range 1 ~ 32768".format(dim) in str(ex)
@ -598,7 +598,7 @@ class TestCollectionParams(TestcaseBase):
int_field = FieldSchema(name="int", dtype=DataType.INT64, dim=ct.default_dim)
float_vec_field = cf.gen_float_vec_field()
schema = cf.gen_collection_schema(fields=[int_field, float_vec_field])
collection, _ = self.collection_wrap.collection_init(c_name, schema=schema)
collection, _ = self.collection_wrap.init_collection(c_name, schema=schema)
assert_default_collection(collection, c_name, exp_schema=schema)
@pytest.mark.tags(CaseLabel.L1)
@ -612,7 +612,7 @@ class TestCollectionParams(TestcaseBase):
self._connect()
c_name = cf.gen_unique_str(prefix)
schema = cf.gen_default_collection_schema(description=desc)
collection, _ = self.collection_wrap.collection_init(c_name, schema=schema)
collection, _ = self.collection_wrap.init_collection(c_name, schema=schema)
assert_default_collection(collection, c_name, exp_schema=schema)
@pytest.mark.tags(CaseLabel.L1)
@ -626,7 +626,7 @@ class TestCollectionParams(TestcaseBase):
c_name = cf.gen_unique_str(prefix)
desc = "a".join("a" for _ in range(256))
schema = cf.gen_default_collection_schema(description=desc)
collection, _ = self.collection_wrap.collection_init(c_name, schema=schema)
collection, _ = self.collection_wrap.init_collection(c_name, schema=schema)
assert_default_collection(collection, c_name, exp_schema=schema)
@pytest.mark.tags(CaseLabel.L0)
@ -640,7 +640,7 @@ class TestCollectionParams(TestcaseBase):
nb = ct.default_nb
c_name = cf.gen_unique_str(prefix)
data = cf.gen_default_dataframe_data(nb)
collection, _ = self.collection_wrap.collection_init(c_name, schema=default_schema, data=data)
collection, _ = self.collection_wrap.init_collection(c_name, schema=default_schema, data=data)
conn.flush([c_name])
assert_default_collection(collection, c_name, exp_num=nb)
@ -655,7 +655,7 @@ class TestCollectionParams(TestcaseBase):
nb = ct.default_nb
c_name = cf.gen_unique_str(prefix)
data = cf.gen_default_list_data(nb)
collection, _ = self.collection_wrap.collection_init(c_name, schema=default_schema, data=data)
collection, _ = self.collection_wrap.init_collection(c_name, schema=default_schema, data=data)
conn.flush([c_name])
assert_default_collection(collection, c_name, exp_num=nb)
@ -668,7 +668,7 @@ class TestCollectionParams(TestcaseBase):
"""
self._connect()
c_name = cf.gen_unique_str(prefix)
collection, _ = self.collection_wrap.collection_init(c_name, data=None, schema=default_binary_schema)
collection, _ = self.collection_wrap.init_collection(c_name, data=None, schema=default_binary_schema)
assert_default_collection(collection, c_name, exp_schema=default_binary_schema)
assert c_name in self.utility_wrap.list_collections()[0]
@ -684,7 +684,7 @@ class TestCollectionParams(TestcaseBase):
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,
collection, _ = self.collection_wrap.init_collection(c_name,
schema=default_binary_schema,
data=data)
assert_default_collection(collection, c_name,
@ -703,7 +703,7 @@ class TestCollectionParams(TestcaseBase):
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,
ex, _ = self.collection_wrap.init_collection(c_name, schema=default_binary_schema,
data=data,
check_task=CheckTasks.err_res)
log.debug(str(ex))
@ -745,7 +745,7 @@ class TestCollectionOperation(TestcaseBase):
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.init_collection(c_name, schema=default_schema,
check_task=CheckTasks.err_res)
assert "There is no connection with alias '{}'".format(ct.default_alias) in str(ex)
assert self.collection_wrap.collection is None
@ -761,7 +761,7 @@ class TestCollectionOperation(TestcaseBase):
c_num = 20
for _ in range(c_num):
c_name = cf.gen_unique_str(prefix)
collection, _ = self.collection_wrap.collection_init(c_name, schema=default_schema)
collection, _ = self.collection_wrap.init_collection(c_name, schema=default_schema)
assert_default_collection(collection, c_name)
collection.drop()
assert c_name not in self.utility_wrap.list_collections()
@ -777,7 +777,7 @@ class TestCollectionOperation(TestcaseBase):
self._connect()
collection = self._collection()
assert_default_collection(collection)
dup_collection, _ = self.collection_wrap.collection_init(collection.name)
dup_collection, _ = self.collection_wrap.init_collection(collection.name)
assert_default_collection(dup_collection, collection.name)
dup_collection.drop()
has, _ = self.utility_wrap.has_collection(collection.name, check_res=CheckTasks.err_res)
@ -797,7 +797,7 @@ class TestCollectionOperation(TestcaseBase):
c_name = cf.gen_unique_str(prefix)
df = cf.gen_default_dataframe_data(nb)
schema = cf.gen_default_collection_schema()
collection, _ = self.collection_wrap.collection_init(name=c_name, data=df)
collection, _ = self.collection_wrap.init_collection(name=c_name, data=df)
conn.flush([c_name])
assert_default_collection(collection, exp_name=c_name, exp_num=nb, exp_schema=schema)
@ -825,7 +825,7 @@ class TestCollectionOperation(TestcaseBase):
"""
self._connect()
c_name = cf.gen_unique_str(prefix)
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None,
ex, _ = self.collection_wrap.init_collection(name=c_name, schema=None,
data=get_invalid_df,
check_task=CheckTasks.err_res)
message_one = "Cannot infer schema from empty dataframe"
@ -845,7 +845,7 @@ class TestCollectionOperation(TestcaseBase):
# 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,
ex, _ = self.collection_wrap.init_collection(name=c_name, schema=None,
data=df,
check_task=CheckTasks.err_res)
assert "The data in the same column must be of the same type" in str(ex)
@ -859,7 +859,7 @@ class TestCollectionOperation(TestcaseBase):
"""
self._connect()
c_name = cf.gen_unique_str(prefix)
ex, _ = self.collection_wrap.collection_init(name=c_name, schema=None,
ex, _ = self.collection_wrap.init_collection(name=c_name, schema=None,
data=get_non_df,
check_task=CheckTasks.err_res)
assert "Data of not pandas.DataFrame type should bepassed into the schema" in str(ex)
@ -874,7 +874,7 @@ class TestCollectionOperation(TestcaseBase):
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,
ex, _ = self.collection_wrap.init_collection(name=c_name, schema=None,
data=data,
check_task=CheckTasks.err_res)
assert "Data of not pandas.DataFrame type should bepassed into the schema" in str(ex)
@ -908,7 +908,7 @@ class TestCollectionOperation(TestcaseBase):
c_name = cf.gen_unique_str(prefix)
df = cf.gen_default_binary_dataframe_data(nb)
schema = cf.gen_default_binary_collection_schema()
collection, _ = self.collection_wrap.collection_init(name=c_name, data=df)
collection, _ = self.collection_wrap.init_collection(name=c_name, data=df)
assert_default_collection(collection, exp_name=c_name, exp_num=nb, exp_schema=schema)
@pytest.mark.tags(CaseLabel.L0)
@ -921,6 +921,6 @@ class TestCollectionOperation(TestcaseBase):
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.init_collection(name=c_name, schema=None, data=data,
check_task=CheckTasks.err_res)
assert "Data of not pandas.DataFrame type should bepassed into the schema" in str(ex)

View File

@ -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()

View File

@ -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()

View File

@ -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

View File

@ -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