未验证 提交 b2a2ef18 编写于 作者: X XuanYang-cn 提交者: GitHub

Update pymilvus version to 2.0.0rc10.dev5 (#15197)

Signed-off-by: Nyangxuan <xuan.yang@zilliz.com>
上级 cc5bee46
...@@ -64,7 +64,7 @@ class Base: ...@@ -64,7 +64,7 @@ class Base:
try: try:
""" Drop collection before disconnect """ """ Drop collection before disconnect """
if self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING)[0] is None: if not self.connection_wrap.has_connection(alias=DefaultConfig.DEFAULT_USING)[0]:
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, host=param_info.param_host, self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, host=param_info.param_host,
port=param_info.param_port) port=param_info.param_port)
...@@ -107,7 +107,7 @@ class TestcaseBase(Base): ...@@ -107,7 +107,7 @@ class TestcaseBase(Base):
def init_collection_wrap(self, name=None, schema=None, shards_num=2, check_task=None, check_items=None, **kwargs): def init_collection_wrap(self, name=None, schema=None, shards_num=2, check_task=None, check_items=None, **kwargs):
name = cf.gen_unique_str('coll_') if name is None else name name = cf.gen_unique_str('coll_') if name is None else name
schema = cf.gen_default_collection_schema() if schema is None else schema schema = cf.gen_default_collection_schema() if schema is None else schema
if self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING)[0] is None: if not self.connection_wrap.has_connection(alias=DefaultConfig.DEFAULT_USING)[0]:
self._connect() self._connect()
collection_w = ApiCollectionWrapper() collection_w = ApiCollectionWrapper()
collection_w.init_collection(name=name, schema=schema, shards_num=shards_num, check_task=check_task, check_items=check_items, **kwargs) collection_w.init_collection(name=name, schema=schema, shards_num=shards_num, check_task=check_task, check_items=check_items, **kwargs)
...@@ -133,7 +133,7 @@ class TestcaseBase(Base): ...@@ -133,7 +133,7 @@ class TestcaseBase(Base):
check_task=check_task, check_items=check_items, check_task=check_task, check_items=check_items,
**kwargs) **kwargs)
return partition_wrap return partition_wrap
def init_collection_general(self, prefix, insert_data=False, nb=ct.default_nb, def init_collection_general(self, prefix, insert_data=False, nb=ct.default_nb,
partition_num=0, is_binary=False, is_all_data_type=False, partition_num=0, is_binary=False, is_all_data_type=False,
auto_id=False, dim=ct.default_dim, is_index=False): auto_id=False, dim=ct.default_dim, is_index=False):
...@@ -185,7 +185,7 @@ class TestcaseBase(Base): ...@@ -185,7 +185,7 @@ class TestcaseBase(Base):
:param half: half of nb :param half: half of nb
:return: collection wrap and partition wrap :return: collection wrap and partition wrap
""" """
conn = self._connect() self._connect()
collection_w = self.init_collection_wrap(name=cf.gen_unique_str(prefix)) collection_w = self.init_collection_wrap(name=cf.gen_unique_str(prefix))
partition_w = self.init_partition_wrap(collection_wrap=collection_w) partition_w = self.init_partition_wrap(collection_wrap=collection_w)
# insert [0, half) into partition_w # insert [0, half) into partition_w
...@@ -194,7 +194,8 @@ class TestcaseBase(Base): ...@@ -194,7 +194,8 @@ class TestcaseBase(Base):
# insert [half, nb) into _default # insert [half, nb) into _default
df_default = cf.gen_default_dataframe_data(nb=half, start=half) df_default = cf.gen_default_dataframe_data(nb=half, start=half)
collection_w.insert(df_default) collection_w.insert(df_default)
conn.flush([collection_w.name]) # flush
collection_w.num_entities
collection_w.load(partition_names=[partition_w.name, "_default"]) collection_w.load(partition_names=[partition_w.name, "_default"])
return collection_w, partition_w, df_partition, df_default return collection_w, partition_w, df_partition, df_default
......
import sys import sys
import time
from pymilvus import Collection from pymilvus import Collection
...@@ -120,6 +121,7 @@ class ApiCollectionWrapper: ...@@ -120,6 +121,7 @@ class ApiCollectionWrapper:
def query(self, expr, output_fields=None, partition_names=None, timeout=None, check_task=None, check_items=None, def query(self, expr, output_fields=None, partition_names=None, timeout=None, check_task=None, check_items=None,
**kwargs): **kwargs):
time.sleep(5)
timeout = TIMEOUT if timeout is None else timeout timeout = TIMEOUT if timeout is None else timeout
func_name = sys._getframe().f_code.co_name func_name = sys._getframe().f_code.co_name
......
...@@ -35,12 +35,18 @@ class ApiConnectionsWrapper: ...@@ -35,12 +35,18 @@ class ApiConnectionsWrapper:
check_result = ResponseChecker(response, func_name, check_task, check_items, succ, alias=alias, **kwargs).run() check_result = ResponseChecker(response, func_name, check_task, check_items, succ, alias=alias, **kwargs).run()
return response, check_result return response, check_result
def get_connection(self, alias=DefaultConfig.DEFAULT_USING, check_task=None, check_items=None): def has_connection(self, alias=DefaultConfig.DEFAULT_USING, check_task=None, check_items=None):
func_name = sys._getframe().f_code.co_name func_name = sys._getframe().f_code.co_name
response, is_succ = api_request([self.connection.get_connection, alias]) response, succ = api_request([self.connection.has_connection, alias])
check_result = ResponseChecker(response, func_name, check_task, check_items, is_succ, alias=alias).run() check_result = ResponseChecker(response, func_name, check_task, check_items, succ, alias=alias).run()
return response, check_result return response, check_result
# def get_connection(self, alias=DefaultConfig.DEFAULT_USING, check_task=None, check_items=None):
# func_name = sys._getframe().f_code.co_name
# response, is_succ = api_request([self.connection.get_connection, alias])
# check_result = ResponseChecker(response, func_name, check_task, check_items, is_succ, alias=alias).run()
# return response, check_result
def list_connections(self, check_task=None, check_items=None): def list_connections(self, check_task=None, check_items=None):
func_name = sys._getframe().f_code.co_name func_name = sys._getframe().f_code.co_name
response, is_succ = api_request([self.connection.list_connections]) response, is_succ = api_request([self.connection.list_connections])
......
...@@ -108,12 +108,13 @@ class ResponseChecker: ...@@ -108,12 +108,13 @@ class ResponseChecker:
if func_name == "connect": if func_name == "connect":
class_obj = Connect_Object_Name class_obj = Connect_Object_Name
res_obj = type(res).__name__ # res_obj = type(res).__name__
assert res_obj == class_obj # assert res_obj == class_obj
if func_name == "get_connection": if func_name == "has_connection":
value_content = params.get(ct.value_content, None)
res_obj = type(res).__name__ if res is not None else None value_content = params.get(ct.value_content, False)
res_obj = res if res is not None else False
assert res_obj == value_content assert res_obj == value_content
return True return True
......
...@@ -52,7 +52,7 @@ max_compaction_interval = 60 # the max time interval (s) from the last compacti ...@@ -52,7 +52,7 @@ max_compaction_interval = 60 # the max time interval (s) from the last compacti
max_field_num = 256 # Maximum number of fields in a collection max_field_num = 256 # Maximum number of fields in a collection
Not_Exist = "Not_Exist" Not_Exist = "Not_Exist"
Connect_Object_Name = "Milvus" Connect_Object_Name = True
list_content = "list_content" list_content = "list_content"
dict_content = "dict_content" dict_content = "dict_content"
value_content = "value_content" value_content = "value_content"
......
...@@ -12,7 +12,7 @@ allure-pytest==2.7.0 ...@@ -12,7 +12,7 @@ allure-pytest==2.7.0
pytest-print==0.2.1 pytest-print==0.2.1
pytest-level==0.1.1 pytest-level==0.1.1
pytest-xdist==2.2.1 pytest-xdist==2.2.1
pymilvus==2.0.0rc9.dev24 pymilvus==2.0.0rc10.dev5
pytest-rerunfailures==9.1.1 pytest-rerunfailures==9.1.1
git+https://github.com/Projectplace/pytest-tags git+https://github.com/Projectplace/pytest-tags
ndg-httpsclient ndg-httpsclient
...@@ -32,4 +32,4 @@ pytest-random-order ...@@ -32,4 +32,4 @@ pytest-random-order
python-benedict==0.24.3 python-benedict==0.24.3
# version need to be consistent with protobuf used in pymilvus # version need to be consistent with protobuf used in pymilvus
protobuf==3.17.1 protobuf==3.17.1
\ No newline at end of file
...@@ -1138,13 +1138,14 @@ class TestCollectionDataframe(TestcaseBase): ...@@ -1138,13 +1138,14 @@ class TestCollectionDataframe(TestcaseBase):
method: create collection and insert with dataframe method: create collection and insert with dataframe
expected: collection num entities equal to nb expected: collection num entities equal to nb
""" """
conn = self._connect() self._connect()
c_name = cf.gen_unique_str(prefix) c_name = cf.gen_unique_str(prefix)
df = cf.gen_default_dataframe_data(ct.default_nb) df = cf.gen_default_dataframe_data(ct.default_nb)
self.collection_wrap.construct_from_dataframe(c_name, df, primary_field=ct.default_int64_field_name, self.collection_wrap.construct_from_dataframe(c_name, df, primary_field=ct.default_int64_field_name,
check_task=CheckTasks.check_collection_property, check_task=CheckTasks.check_collection_property,
check_items={exp_name: c_name, exp_schema: default_schema}) check_items={exp_name: c_name, exp_schema: default_schema})
conn.flush([c_name]) # flush
self.collection_wrap.num_entities
assert self.collection_wrap.num_entities == ct.default_nb assert self.collection_wrap.num_entities == ct.default_nb
@pytest.mark.tags(CaseLabel.L0) @pytest.mark.tags(CaseLabel.L0)
...@@ -1406,7 +1407,7 @@ class TestCollectionDataframe(TestcaseBase): ...@@ -1406,7 +1407,7 @@ class TestCollectionDataframe(TestcaseBase):
method: create collection with dup name, none schema, dataframe method: create collection with dup name, none schema, dataframe
expected: two collection object is correct expected: two collection object is correct
""" """
conn = self._connect() self._connect()
c_name = cf.gen_unique_str(prefix) c_name = cf.gen_unique_str(prefix)
collection_w = self.init_collection_wrap(name=c_name, primary_field=ct.default_int64_field_name, collection_w = self.init_collection_wrap(name=c_name, primary_field=ct.default_int64_field_name,
check_task=CheckTasks.check_collection_property, check_task=CheckTasks.check_collection_property,
...@@ -1415,7 +1416,8 @@ class TestCollectionDataframe(TestcaseBase): ...@@ -1415,7 +1416,8 @@ class TestCollectionDataframe(TestcaseBase):
self.collection_wrap.construct_from_dataframe(c_name, df, primary_field=ct.default_int64_field_name, self.collection_wrap.construct_from_dataframe(c_name, df, primary_field=ct.default_int64_field_name,
check_task=CheckTasks.check_collection_property, check_task=CheckTasks.check_collection_property,
check_items={exp_name: c_name, exp_schema: default_schema}) check_items={exp_name: c_name, exp_schema: default_schema})
conn.flush([collection_w.name]) # flush
self.collection_wrap.num_entities
assert collection_w.num_entities == ct.default_nb assert collection_w.num_entities == ct.default_nb
assert collection_w.num_entities == self.collection_wrap.num_entities assert collection_w.num_entities == self.collection_wrap.num_entities
......
...@@ -67,7 +67,7 @@ class TestConnectionParams(TestcaseBase): ...@@ -67,7 +67,7 @@ class TestConnectionParams(TestcaseBase):
self.connection_wrap.connect(alias=alias, check_task=ct.CheckTasks.err_res, self.connection_wrap.connect(alias=alias, check_task=ct.CheckTasks.err_res,
check_items={ct.err_code: 0, ct.err_msg: cem.AliasType % type(alias)}) check_items={ct.err_code: 0, ct.err_msg: cem.AliasType % type(alias)})
@pytest.mark.tags(ct.CaseLabel.L2) @pytest.mark.skip("get_connection is replaced by has_connection")
@pytest.mark.parametrize("alias", ct.get_not_string) @pytest.mark.parametrize("alias", ct.get_not_string)
def test_connection_get_alias_param_check(self, alias): def test_connection_get_alias_param_check(self, alias):
""" """
...@@ -173,8 +173,8 @@ class TestConnectionOperation(TestcaseBase): ...@@ -173,8 +173,8 @@ class TestConnectionOperation(TestcaseBase):
alias2={"host": "192.168.1.1", "port": "123"}) alias2={"host": "192.168.1.1", "port": "123"})
# get the object of alias # get the object of alias
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr, self.connection_wrap.has_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
check_items={ct.value_content: None}) check_items={ct.value_content: False})
# list all connections and check the response # list all connections and check the response
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr, self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
...@@ -436,7 +436,7 @@ class TestConnectionOperation(TestcaseBase): ...@@ -436,7 +436,7 @@ class TestConnectionOperation(TestcaseBase):
# list all connections and check the response # list all connections and check the response
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr, self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING,
ct.Connect_Object_Name)]}) "GrpcHandler")]})
# get all addr of alias and check the response # get all addr of alias and check the response
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr, self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
...@@ -458,14 +458,14 @@ class TestConnectionOperation(TestcaseBase): ...@@ -458,14 +458,14 @@ class TestConnectionOperation(TestcaseBase):
self.connection_wrap.connect(alias=connect_name, check_task=ct.CheckTasks.ccr) self.connection_wrap.connect(alias=connect_name, check_task=ct.CheckTasks.ccr)
# get the object of alias # get the object of alias
res_obj1 = self.connection_wrap.get_connection(alias=connect_name, check_task=ct.CheckTasks.ccr, res_obj1 = self.connection_wrap.has_connection(alias=connect_name, check_task=ct.CheckTasks.ccr,
check_items={ct.value_content: ct.Connect_Object_Name})[0] check_items={ct.value_content: ct.Connect_Object_Name})[0]
# connect twice with the same params # connect twice with the same params
self.connection_wrap.connect(alias=connect_name, host=host, port=port, check_task=ct.CheckTasks.ccr) self.connection_wrap.connect(alias=connect_name, host=host, port=port, check_task=ct.CheckTasks.ccr)
# get the object of alias # get the object of alias
res_obj2 = self.connection_wrap.get_connection(alias=connect_name, check_task=ct.CheckTasks.ccr, res_obj2 = self.connection_wrap.has_connection(alias=connect_name, check_task=ct.CheckTasks.ccr,
check_items={ct.value_content: ct.Connect_Object_Name})[0] check_items={ct.value_content: ct.Connect_Object_Name})[0]
# check the response of the same alias is equal # check the response of the same alias is equal
...@@ -490,11 +490,11 @@ class TestConnectionOperation(TestcaseBase): ...@@ -490,11 +490,11 @@ class TestConnectionOperation(TestcaseBase):
self.connection_wrap.connect(alias=connect_name, host=host, port=port, check_task=ct.CheckTasks.ccr) self.connection_wrap.connect(alias=connect_name, host=host, port=port, check_task=ct.CheckTasks.ccr)
# get the object of alias # get the object of alias
self.connection_wrap.get_connection(alias=connect_name, check_task=ct.CheckTasks.ccr, self.connection_wrap.has_connection(alias=connect_name, check_task=ct.CheckTasks.ccr,
check_items={ct.value_content: ct.Connect_Object_Name}) check_items={ct.value_content: ct.Connect_Object_Name})
# list all connections and check the response # list all connections and check the response
list_content = [(connect_name, ct.Connect_Object_Name)] if connect_name is DefaultConfig.DEFAULT_USING else \ list_content = [(connect_name, "GrpcHandler")] if connect_name is DefaultConfig.DEFAULT_USING else \
[(DefaultConfig.DEFAULT_USING, None), (connect_name, ct.Connect_Object_Name)] [(DefaultConfig.DEFAULT_USING, None), (connect_name, ct.Connect_Object_Name)]
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr, self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
check_items={ct.list_content: list_content}) check_items={ct.list_content: list_content})
...@@ -558,7 +558,7 @@ class TestConnectionOperation(TestcaseBase): ...@@ -558,7 +558,7 @@ class TestConnectionOperation(TestcaseBase):
method: 1. connect with default alias method: 1. connect with default alias
2. get connection 2. get connection
3. disconnect with default alias 3. disconnect with default alias
4. get connection 4. has connection
5. disconnect again 5. disconnect again
6. list connections and get connection address 6. list connections and get connection address
expected: the connection was successfully terminated expected: the connection was successfully terminated
...@@ -571,15 +571,15 @@ class TestConnectionOperation(TestcaseBase): ...@@ -571,15 +571,15 @@ class TestConnectionOperation(TestcaseBase):
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr) self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr)
# get the object of alias # get the object of alias
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr, self.connection_wrap.has_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
check_items={ct.value_content: ct.Connect_Object_Name}) check_items={ct.value_content: ct.Connect_Object_Name})
# disconnect alias is exist # disconnect alias is exist
self.connection_wrap.disconnect(alias=DefaultConfig.DEFAULT_USING) self.connection_wrap.disconnect(alias=DefaultConfig.DEFAULT_USING)
# get the object of alias # get the object of alias
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr, self.connection_wrap.has_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
check_items={ct.value_content: None}) check_items={ct.value_content: False})
# disconnect twice # disconnect twice
self.connection_wrap.disconnect(alias=DefaultConfig.DEFAULT_USING) self.connection_wrap.disconnect(alias=DefaultConfig.DEFAULT_USING)
...@@ -613,7 +613,7 @@ class TestConnectionOperation(TestcaseBase): ...@@ -613,7 +613,7 @@ class TestConnectionOperation(TestcaseBase):
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr, self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None), check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None),
( (
test_alias_name, ct.Connect_Object_Name)]}) test_alias_name, "GrpcHandler")]})
# get all addr of alias and check the response # get all addr of alias and check the response
self.connection_wrap.get_connection_addr(alias=test_alias_name, check_task=ct.CheckTasks.ccr, self.connection_wrap.get_connection_addr(alias=test_alias_name, check_task=ct.CheckTasks.ccr,
...@@ -676,8 +676,8 @@ class TestConnectionOperation(TestcaseBase): ...@@ -676,8 +676,8 @@ class TestConnectionOperation(TestcaseBase):
self.connection_wrap.remove_connection(alias=connect_name) self.connection_wrap.remove_connection(alias=connect_name)
# get the object of alias # get the object of alias
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr, self.connection_wrap.has_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
check_items={ct.value_content: None}) check_items={ct.value_content: False})
# list all connections and check the response # list all connections and check the response
list_content = [] if connect_name == DefaultConfig.DEFAULT_USING else [(DefaultConfig.DEFAULT_USING, None)] list_content = [] if connect_name == DefaultConfig.DEFAULT_USING else [(DefaultConfig.DEFAULT_USING, None)]
...@@ -795,11 +795,8 @@ class TestConnect: ...@@ -795,11 +795,8 @@ class TestConnect:
expected: connected is True expected: connected is True
""" """
uri_value = "" uri_value = ""
if self.local_ip(args): with pytest.raises(Exception) as e:
milvus = get_milvus(None, None, uri=uri_value, handler=args["handler"]) milvus = get_milvus(None, None, uri=uri_value, handler=args["handler"])
else:
with pytest.raises(Exception) as e:
milvus = get_milvus(None, None, uri=uri_value, handler=args["handler"])
@pytest.mark.tags(ct.CaseLabel.L2) @pytest.mark.tags(ct.CaseLabel.L2)
def test_connect_with_multiprocess(self, args): def test_connect_with_multiprocess(self, args):
......
...@@ -399,7 +399,6 @@ class TestDeleteOperation(TestcaseBase): ...@@ -399,7 +399,6 @@ class TestDeleteOperation(TestcaseBase):
collection_w.query(expr=f'{ct.default_int64_field_name} in {[0, tmp_nb]}', collection_w.query(expr=f'{ct.default_int64_field_name} in {[0, tmp_nb]}',
check_task=CheckTasks.check_query_empty) check_task=CheckTasks.check_query_empty)
@pytest.mark.skip("enable this later using session/strong consistency")
@pytest.mark.tags(CaseLabel.L1) @pytest.mark.tags(CaseLabel.L1)
def test_delete_search(self): def test_delete_search(self):
""" """
......
...@@ -199,7 +199,8 @@ class TestIndexOperation(TestcaseBase): ...@@ -199,7 +199,8 @@ class TestIndexOperation(TestcaseBase):
collection_w = self.init_collection_wrap(name=c_name) collection_w = self.init_collection_wrap(name=c_name)
data = cf.gen_default_list_data() data = cf.gen_default_list_data()
collection_w.insert(data=data) collection_w.insert(data=data)
self._connect().flush([collection_w.name]) # flush
collection_w.num_entities
index, _ = self.index_wrap.init_index(collection_w.collection, default_field_name, default_index_params) index, _ = self.index_wrap.init_index(collection_w.collection, default_field_name, default_index_params)
# TODO: assert index # TODO: assert index
cf.assert_equal_index(index, collection_w.collection.indexes[0]) cf.assert_equal_index(index, collection_w.collection.indexes[0])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册