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