mirror of https://github.com/milvus-io/milvus.git
[skip ci] Add test cases of connection interface (#5871)
Signed-off-by: wangting0128 <ting.wang@zilliz.com>pull/5872/head
parent
2f8bccda8d
commit
78ffc95d70
|
@ -31,7 +31,7 @@ class ResponseChecker:
|
|||
elif self.check_task == CheckTasks.err_res:
|
||||
result = self.assert_exception(self.response, self.succ, self.check_items)
|
||||
|
||||
elif self.check_task == CheckTasks.check_connection_result:
|
||||
elif self.check_task == CheckTasks.ccr:
|
||||
result = self.check_value_equal(self.response, self.func_name, self.check_items)
|
||||
|
||||
elif self.check_task == CheckTasks.check_collection_property:
|
||||
|
@ -73,7 +73,7 @@ class ResponseChecker:
|
|||
log.error("[CheckFunc] Response of list_connections is not a list: %s" % str(res))
|
||||
assert False
|
||||
|
||||
list_content = params.get("list_content", None)
|
||||
list_content = params.get(ct.list_content, None)
|
||||
if not isinstance(list_content, list):
|
||||
log.error("[CheckFunc] Check param of list_content is not a list: %s" % str(list_content))
|
||||
assert False
|
||||
|
@ -82,7 +82,7 @@ class ResponseChecker:
|
|||
assert pc.list_equal_check(new_res, list_content)
|
||||
|
||||
if func_name == "get_connection_addr":
|
||||
dict_content = params.get("dict_content", None)
|
||||
dict_content = params.get(ct.dict_content, None)
|
||||
assert pc.dict_equal_check(res, dict_content)
|
||||
|
||||
if func_name == "connect":
|
||||
|
@ -91,7 +91,7 @@ class ResponseChecker:
|
|||
assert res_obj == class_obj
|
||||
|
||||
if func_name == "get_connection":
|
||||
value_content = params.get("value_content", None)
|
||||
value_content = params.get(ct.value_content, None)
|
||||
res_obj = type(res).__name__ if res is not None else None
|
||||
assert res_obj == value_content
|
||||
|
||||
|
|
|
@ -36,6 +36,9 @@ binary_vec_field_desc = "binary vector type field"
|
|||
|
||||
Not_Exist = "Not_Exist"
|
||||
Connect_Object_Name = "Milvus"
|
||||
list_content = "list_content"
|
||||
dict_content = "dict_content"
|
||||
value_content = "value_content"
|
||||
|
||||
err_code = "err_code"
|
||||
err_msg = "err_msg"
|
||||
|
@ -79,7 +82,7 @@ class CheckTasks:
|
|||
""" The name of the method used to check the result """
|
||||
false = False
|
||||
err_res = "error_response"
|
||||
check_connection_result = "check_connection_result"
|
||||
ccr = "check_connection_result"
|
||||
check_collection_property = "check_collection_property"
|
||||
check_partition_property = "check_partition_property"
|
||||
check_search_results = "check_search_results"
|
||||
|
|
|
@ -18,6 +18,7 @@ def pytest_addoption(parser):
|
|||
parser.addoption('--index_param', action='store', default="index_param", help="index_param of index")
|
||||
parser.addoption('--data', action='store', default="data", help="data of request")
|
||||
parser.addoption('--clean_log', action='store_true', default=False, help="clean log before testing")
|
||||
parser.addoption('--schema', action='store', default="schema", help="schema of test interface")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -98,3 +99,8 @@ def data(request):
|
|||
@pytest.fixture
|
||||
def clean_log(request):
|
||||
return request.config.getoption("--clean_log")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def schema(request):
|
||||
return request.config.getoption("--schema")
|
||||
|
|
|
@ -4,8 +4,8 @@ import os
|
|||
from pymilvus_orm.default_config import DefaultConfig
|
||||
from base.client_base import TestcaseBase
|
||||
from utils.util_log import test_log as log
|
||||
from common.common_type import *
|
||||
from check.param_check import *
|
||||
import common.common_type as ct
|
||||
import common.common_func as cf
|
||||
|
||||
|
||||
class TestConnectionParams(TestcaseBase):
|
||||
|
@ -15,7 +15,7 @@ class TestConnectionParams(TestcaseBase):
|
|||
"""
|
||||
|
||||
@pytest.mark.xfail(reason="Issue #5684")
|
||||
@pytest.mark.tags(CaseLabel.L3)
|
||||
@pytest.mark.tags(ct.CaseLabel.L3)
|
||||
def test_connection_add_connection_kwargs_param_check(self):
|
||||
"""
|
||||
target: test **kwargs of add_connection
|
||||
|
@ -30,11 +30,11 @@ class TestConnectionParams(TestcaseBase):
|
|||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING)
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
|
||||
@pytest.mark.xfail(reason="Issue #5723")
|
||||
@pytest.mark.tags(CaseLabel.L3)
|
||||
@pytest.mark.tags(ct.CaseLabel.L3)
|
||||
def test_connection_connect_kwargs_param_check(self):
|
||||
"""
|
||||
target: test **kwargs of connect
|
||||
|
@ -51,8 +51,8 @@ class TestConnectionParams(TestcaseBase):
|
|||
assert "Fail connecting to server" in res[0].args[0]
|
||||
|
||||
@pytest.mark.xfail(reason="Feature #5725")
|
||||
@pytest.mark.tags(CaseLabel.L3)
|
||||
@pytest.mark.parametrize("alias", get_invalid_strs)
|
||||
@pytest.mark.tags(ct.CaseLabel.L3)
|
||||
@pytest.mark.parametrize("alias", ct.get_invalid_strs)
|
||||
def test_connection_connect_alias_param_check(self, alias):
|
||||
"""
|
||||
target: test connect passes wrong params of alias
|
||||
|
@ -65,8 +65,8 @@ class TestConnectionParams(TestcaseBase):
|
|||
log.info(res[0])
|
||||
|
||||
@pytest.mark.xfail(reason="Feature #5725")
|
||||
@pytest.mark.parametrize("alias", get_invalid_strs)
|
||||
@pytest.mark.tags(CaseLabel.L3)
|
||||
@pytest.mark.parametrize("alias", ct.get_invalid_strs)
|
||||
@pytest.mark.tags(ct.CaseLabel.L3)
|
||||
def test_connection_get_alias_param_check(self, alias):
|
||||
"""
|
||||
target: test get connection passes wrong params of alias
|
||||
|
@ -79,8 +79,8 @@ class TestConnectionParams(TestcaseBase):
|
|||
log.info(res[0])
|
||||
|
||||
@pytest.mark.xfail(reason="Feature #5725")
|
||||
@pytest.mark.parametrize("alias", get_invalid_strs)
|
||||
@pytest.mark.tags(CaseLabel.L3)
|
||||
@pytest.mark.parametrize("alias", ct.get_invalid_strs)
|
||||
@pytest.mark.tags(ct.CaseLabel.L3)
|
||||
def test_connection_get_addr_alias_param_check(self, alias):
|
||||
"""
|
||||
target: test get connection addr passes wrong params of alias
|
||||
|
@ -93,8 +93,8 @@ class TestConnectionParams(TestcaseBase):
|
|||
log.info(res[0])
|
||||
|
||||
@pytest.mark.xfail(reason="Feature #5725")
|
||||
@pytest.mark.parametrize("alias", get_invalid_strs)
|
||||
@pytest.mark.tags(CaseLabel.L3)
|
||||
@pytest.mark.parametrize("alias", ct.get_invalid_strs)
|
||||
@pytest.mark.tags(ct.CaseLabel.L3)
|
||||
def test_connection_remove_alias_param_check(self, alias):
|
||||
"""
|
||||
target: test remove connection passes wrong params of alias
|
||||
|
@ -108,8 +108,8 @@ class TestConnectionParams(TestcaseBase):
|
|||
log.info(res[0])
|
||||
|
||||
@pytest.mark.xfail(reason="Feature #5725")
|
||||
@pytest.mark.parametrize("alias", get_invalid_strs)
|
||||
@pytest.mark.tags(CaseLabel.L3)
|
||||
@pytest.mark.parametrize("alias", ct.get_invalid_strs)
|
||||
@pytest.mark.tags(ct.CaseLabel.L3)
|
||||
def test_connection_disconnect_alias_param_check(self, alias):
|
||||
"""
|
||||
target: test disconnect passes wrong params of alias
|
||||
|
@ -130,7 +130,7 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
@pytest.mark.xfail(reason="#5684")
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_add_wrong_format(self):
|
||||
"""
|
||||
target: test add_connection, regardless of whether the connection exists
|
||||
|
@ -144,22 +144,22 @@ class TestConnectionOperation(TestcaseBase):
|
|||
testing={"": ""})
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None),
|
||||
('alias1', None), ('alias2', None),
|
||||
('testing', None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None),
|
||||
('alias1', None), ('alias2', None),
|
||||
('testing', None)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': 'localhost', 'port': '19530'}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias1", check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {"host": "localhost", "port": "1"}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias2", check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {"host": "hostlocal", "port": "-1"}})
|
||||
self.connection_wrap.get_connection_addr(alias="testing", check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {"": ""}})
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': 'localhost', 'port': '19530'}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias1", check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {"host": "localhost", "port": "1"}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias2", check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {"host": "hostlocal", "port": "-1"}})
|
||||
self.connection_wrap.get_connection_addr(alias="testing", check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {"": ""}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_add_more(self):
|
||||
"""
|
||||
target: test add_connection passes in multiple parameters
|
||||
|
@ -172,23 +172,23 @@ class TestConnectionOperation(TestcaseBase):
|
|||
alias2={"host": "192.168.1.1", "port": "123"})
|
||||
|
||||
# get the object of alias
|
||||
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"value_content": None})
|
||||
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.value_content: None})
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None),
|
||||
('alias1', None), ('alias2', None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None),
|
||||
('alias1', None), ('alias2', None)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': 'localhost', 'port': '19530'}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias1", check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {"host": "localhost", "port": "1"}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias2", check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {"host": "192.168.1.1", "port": "123"}})
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': 'localhost', 'port': '19530'}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias1", check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {"host": "localhost", "port": "1"}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias2", check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {"host": "192.168.1.1", "port": "123"}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_add_single_more(self):
|
||||
"""
|
||||
target: test add connections separately
|
||||
|
@ -201,20 +201,19 @@ class TestConnectionOperation(TestcaseBase):
|
|||
self.connection_wrap.add_connection(alias2={"host": "192.168.1.1", "port": "123"})
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None),
|
||||
('alias1', None), ('alias2', None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None),
|
||||
('alias1', None), ('alias2', None)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': 'localhost', 'port': '19530'}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias1", check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {"host": "localhost", "port": "1"}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias2", check_task=CheckTasks.check_connection_result,
|
||||
check_items={
|
||||
"dict_content": {"host": "192.168.1.1", "port": "123"}})
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': 'localhost', 'port': '19530'}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias1", check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {"host": "localhost", "port": "1"}})
|
||||
self.connection_wrap.get_connection_addr(alias="alias2", check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {"host": "192.168.1.1", "port": "123"}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
@pytest.mark.tags(ct.CaseLabel.L0)
|
||||
def test_connection_add_default(self):
|
||||
"""
|
||||
target: add_connection passes default params successfully
|
||||
|
@ -227,14 +226,14 @@ class TestConnectionOperation(TestcaseBase):
|
|||
self.connection_wrap.add_connection(default={'port': '19530', 'host': 'localhost'})
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': 'localhost', 'port': '19530'}})
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': 'localhost', 'port': '19530'}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
@pytest.mark.tags(ct.CaseLabel.L0)
|
||||
def test_connection_add_cover_default(self):
|
||||
"""
|
||||
target: add a connection to override the default connection
|
||||
|
@ -243,21 +242,22 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# get all addr of default alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': 'localhost', 'port': '19530'}})
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': 'localhost', 'port': '19530'}})
|
||||
|
||||
# add connections
|
||||
self.connection_wrap.add_connection(default={'host': '192.168.1.1', 'port': '12345'})
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': '192.168.1.1', 'port': '12345'}})
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': '192.168.1.1',
|
||||
'port': '12345'}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_get_addr_not_exist(self):
|
||||
"""
|
||||
target: get addr of alias that is not exist and return {}
|
||||
|
@ -266,18 +266,18 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# get an addr that not exist and return {}
|
||||
self.connection_wrap.get_connection_addr(alias=Not_Exist, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {}})
|
||||
self.connection_wrap.get_connection_addr(alias=ct.Not_Exist, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {}})
|
||||
|
||||
@pytest.mark.skip("The maximum number of add_connection is not set")
|
||||
@pytest.mark.tags(CaseLabel.L2)
|
||||
@pytest.mark.tags(ct.CaseLabel.L2)
|
||||
def test_connection_add_max(self):
|
||||
"""
|
||||
The maximum number of add_connection is not set
|
||||
"""
|
||||
pass
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_add_after_connect(self, host, port):
|
||||
"""
|
||||
target: add_connect passes different params after normal connect
|
||||
|
@ -286,19 +286,19 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# create connection that param of alias is not exist
|
||||
self.connection_wrap.connect(alias="test_alias_name", host=host, port=port, check_task=CheckTasks.check_connection_result)
|
||||
self.connection_wrap.connect(alias="test_alias_name", host=host, port=port, check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# add connection with diff params after that alias has been created
|
||||
err_msg = "alias of 'test_alias_name' already creating connections, "\
|
||||
+ "but the configure is not the same as passed in."
|
||||
self.connection_wrap.add_connection(test_alias_name={"host": "localhost", "port": "1"},
|
||||
check_task=CheckTasks.err_res,
|
||||
check_task=ct.CheckTasks.err_res,
|
||||
check_items={"err_code": -1, "err_msg": err_msg})
|
||||
|
||||
# add connection with the same params
|
||||
self.connection_wrap.add_connection(test_alias_name={"host": host, "port": port})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_add_after_default_connect(self, host, port):
|
||||
"""
|
||||
target: add_connect passes different params after normal connect passes default alias
|
||||
|
@ -307,19 +307,19 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
# create connection that param of alias is default
|
||||
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, host=host, port=port,
|
||||
check_task=CheckTasks.check_connection_result)
|
||||
check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# add connection after that alias has been created
|
||||
err_msg = "alias of 'test_alias_name' already creating connections, " \
|
||||
+ "but the configure is not the same as passed in."
|
||||
self.connection_wrap.add_connection(default={"host": "localhost", "port": "1"},
|
||||
check_task=CheckTasks.err_res,
|
||||
check_task=ct.CheckTasks.err_res,
|
||||
check_items={"err_code": -1, "err_msg": err_msg})
|
||||
|
||||
# add connection with the same params
|
||||
self.connection_wrap.add_connection(test_alias_name={"host": host, "port": port})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_add_after_disconnect(self, host, port):
|
||||
"""
|
||||
target: add_connect after normal connect、disconnect
|
||||
|
@ -328,23 +328,23 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# create connection that param of alias is not exist
|
||||
self.connection_wrap.connect(alias="test_alias_name", host=host, port=port, check_task=CheckTasks.check_connection_result)
|
||||
self.connection_wrap.connect(alias="test_alias_name", host=host, port=port, check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# disconnect alias is exist
|
||||
self.connection_wrap.disconnect(alias="test_alias_name")
|
||||
|
||||
# get an addr that is exist
|
||||
self.connection_wrap.get_connection_addr(alias="test_alias_name", check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {"host": host, "port": port}})
|
||||
self.connection_wrap.get_connection_addr(alias="test_alias_name", check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {"host": host, "port": port}})
|
||||
|
||||
# add connection after that alias has been disconnected
|
||||
self.connection_wrap.add_connection(test_alias_name={"host": "localhost", "port": "1"})
|
||||
|
||||
# get an addr that is exist
|
||||
self.connection_wrap.get_connection_addr(alias="test_alias_name", check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {"host": "localhost", "port": "1"}})
|
||||
self.connection_wrap.get_connection_addr(alias="test_alias_name", check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {"host": "localhost", "port": "1"}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_add_after_remove(self, host, port):
|
||||
"""
|
||||
target: add_connect after normal connect、remove_connection
|
||||
|
@ -353,23 +353,23 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# create connection that param of alias is not exist
|
||||
self.connection_wrap.connect(alias="test_alias_name", host=host, port=port, check_task=CheckTasks.check_connection_result)
|
||||
self.connection_wrap.connect(alias="test_alias_name", host=host, port=port, check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# disconnect alias is exist
|
||||
self.connection_wrap.remove_connection(alias="test_alias_name")
|
||||
|
||||
# get an addr that is not exist
|
||||
self.connection_wrap.get_connection_addr(alias="test_alias_name", check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {}})
|
||||
self.connection_wrap.get_connection_addr(alias="test_alias_name", check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {}})
|
||||
|
||||
# add connection after that alias has been disconnected
|
||||
self.connection_wrap.add_connection(test_alias_name={"host": "localhost", "port": "1"})
|
||||
|
||||
# get an addr that is exist
|
||||
self.connection_wrap.get_connection_addr(alias="test_alias_name", check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {"host": "localhost", "port": "1"}})
|
||||
self.connection_wrap.get_connection_addr(alias="test_alias_name", check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {"host": "localhost", "port": "1"}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_connect_alias_not_exist(self):
|
||||
"""
|
||||
target: connect passes alias that is not exist and raise error
|
||||
|
@ -378,19 +378,19 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# create connection that param of alias is not exist
|
||||
err_msg = "You need to pass in the configuration of the connection named '%s'" % Not_Exist
|
||||
self.connection_wrap.connect(alias=Not_Exist, check_task=CheckTasks.err_res, check_items={"err_code": -1,
|
||||
"err_msg": err_msg})
|
||||
err_msg = "You need to pass in the configuration of the connection named '%s'" % ct.Not_Exist
|
||||
self.connection_wrap.connect(alias=ct.Not_Exist, check_task=ct.CheckTasks.err_res,
|
||||
check_items={"err_code": -1, "err_msg": err_msg})
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': "localhost", 'port': "19530"}})
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': "localhost", 'port': "19530"}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_connect_default_alias_invalid(self, port):
|
||||
"""
|
||||
target: connect passes configure is not exist and raise error
|
||||
|
@ -403,18 +403,18 @@ class TestConnectionOperation(TestcaseBase):
|
|||
|
||||
# using default alias to create connection, the connection does not exist
|
||||
err_msg = "Fail connecting to server on localhost:19530. Timeout"
|
||||
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.err_res,
|
||||
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.err_res,
|
||||
check_items={"err_code": -1, "err_msg": err_msg})
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': "host", 'port': port}})
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': "host", 'port': port}})
|
||||
|
||||
@ pytest.mark.tags(CaseLabel.L0)
|
||||
@ pytest.mark.tags(ct.CaseLabel.L0)
|
||||
def test_connection_connect_default_alias_effective(self, host, port):
|
||||
"""
|
||||
target: connect passes useful configure that adds by add_connect
|
||||
|
@ -426,18 +426,18 @@ class TestConnectionOperation(TestcaseBase):
|
|||
self.connection_wrap.add_connection(default={'host': host, 'port': port})
|
||||
|
||||
# successfully created default connection
|
||||
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result)
|
||||
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING,
|
||||
Connect_Object_Name)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING,
|
||||
ct.Connect_Object_Name)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': host, 'port': port}})
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': host, 'port': port}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
@pytest.mark.parametrize("connect_name", [DefaultConfig.DEFAULT_USING])
|
||||
def test_connection_connect_repeat(self, host, port, connect_name):
|
||||
"""
|
||||
|
@ -450,19 +450,18 @@ class TestConnectionOperation(TestcaseBase):
|
|||
self.connection_wrap.add_connection(default={'host': host, 'port': port})
|
||||
|
||||
# successfully created default connection
|
||||
self.connection_wrap.connect(alias=connect_name, check_task=CheckTasks.check_connection_result)
|
||||
self.connection_wrap.connect(alias=connect_name, check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# get the object of alias
|
||||
res_obj1 = self.connection_wrap.get_connection(alias=connect_name, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"value_content": Connect_Object_Name})[0]
|
||||
res_obj1 = self.connection_wrap.get_connection(alias=connect_name, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.value_content: ct.Connect_Object_Name})[0]
|
||||
|
||||
# connect twice with the same params
|
||||
self.connection_wrap.connect(alias=connect_name, host=host, port=port,
|
||||
check_task=CheckTasks.check_connection_result)
|
||||
self.connection_wrap.connect(alias=connect_name, host=host, port=port, check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# get the object of alias
|
||||
res_obj2 = self.connection_wrap.get_connection(alias=connect_name, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"value_content": Connect_Object_Name})[0]
|
||||
res_obj2 = self.connection_wrap.get_connection(alias=connect_name, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.value_content: ct.Connect_Object_Name})[0]
|
||||
|
||||
# check the response of the same alias is equal
|
||||
assert res_obj1 == res_obj2
|
||||
|
@ -471,9 +470,9 @@ class TestConnectionOperation(TestcaseBase):
|
|||
err_msg = "The connection named default already creating," \
|
||||
+ " but passed parameters don't match the configured parameters,"
|
||||
self.connection_wrap.connect(alias=connect_name, host="host", port=port,
|
||||
check_task=CheckTasks.err_res, check_items={"err_code": -1, "err_msg": err_msg})
|
||||
check_task=ct.CheckTasks.err_res, check_items={"err_code": -1, "err_msg": err_msg})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L2)
|
||||
@pytest.mark.tags(ct.CaseLabel.L2)
|
||||
@pytest.mark.parametrize("connect_name", [DefaultConfig.DEFAULT_USING, "test_alias_nme"])
|
||||
def test_connection_connect_params(self, host, port, connect_name):
|
||||
"""
|
||||
|
@ -483,24 +482,24 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# successfully created default connection
|
||||
self.connection_wrap.connect(alias=connect_name, host=host, port=port, check_task=CheckTasks.check_connection_result)
|
||||
self.connection_wrap.connect(alias=connect_name, host=host, port=port, check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# get the object of alias
|
||||
self.connection_wrap.get_connection(alias=connect_name, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"value_content": Connect_Object_Name})
|
||||
self.connection_wrap.get_connection(alias=connect_name, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.value_content: ct.Connect_Object_Name})
|
||||
|
||||
# list all connections and check the response
|
||||
list_content = [(connect_name, Connect_Object_Name)] if connect_name is DefaultConfig.DEFAULT_USING else\
|
||||
[(DefaultConfig.DEFAULT_USING, None), (connect_name, Connect_Object_Name)]
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": list_content})
|
||||
list_content = [(connect_name, ct.Connect_Object_Name)] if connect_name is DefaultConfig.DEFAULT_USING else\
|
||||
[(DefaultConfig.DEFAULT_USING, None), (connect_name, ct.Connect_Object_Name)]
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: list_content})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=connect_name, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': host, 'port': port}})
|
||||
self.connection_wrap.get_connection_addr(alias=connect_name, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': host, 'port': port}})
|
||||
|
||||
@pytest.mark.xfail(reason="5697")
|
||||
@pytest.mark.tags(CaseLabel.L3)
|
||||
@pytest.mark.tags(ct.CaseLabel.L3)
|
||||
@pytest.mark.parametrize("connect_name", [DefaultConfig.DEFAULT_USING, "test_alias_nme"])
|
||||
def test_connection_connect_wrong_params(self, host, port, connect_name):
|
||||
"""
|
||||
|
@ -510,21 +509,21 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# created connection with wrong connect name
|
||||
self.connection_wrap.connect(alias=connect_name, ip=host, port=port, check_task=CheckTasks.err_res,
|
||||
self.connection_wrap.connect(alias=connect_name, ip=host, port=port, check_task=ct.CheckTasks.err_res,
|
||||
check_items={"err_code": -1,
|
||||
"err_msg": "Param is not complete. Please invoke as follow:"})
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
dict_content = {'host': host, 'port': port} if connect_name == DefaultConfig.DEFAULT_USING else {}
|
||||
self.connection_wrap.get_connection_addr(alias=connect_name, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": dict_content})
|
||||
self.connection_wrap.get_connection_addr(alias=connect_name, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: dict_content})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L3)
|
||||
@pytest.mark.parametrize("connect_name", [DefaultConfig.DEFAULT_USING, Not_Exist])
|
||||
@pytest.mark.tags(ct.CaseLabel.L3)
|
||||
@pytest.mark.parametrize("connect_name", [DefaultConfig.DEFAULT_USING, ct.Not_Exist])
|
||||
def test_connection_disconnect_not_exist(self, connect_name):
|
||||
"""
|
||||
target: disconnect passes alias that is not exist
|
||||
|
@ -533,20 +532,21 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
# disconnect alias is not exist
|
||||
self.connection_wrap.disconnect(alias=connect_name)
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {"host": "localhost", "port": "19530"}})
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING,
|
||||
check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {"host": "localhost", "port": "19530"}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
@pytest.mark.tags(ct.CaseLabel.L0)
|
||||
def test_connection_disconnect_after_default_connect(self, host, port):
|
||||
"""
|
||||
target: disconnect default connect and check result
|
||||
|
@ -558,31 +558,31 @@ class TestConnectionOperation(TestcaseBase):
|
|||
self.connection_wrap.add_connection(default={'host': host, 'port': port})
|
||||
|
||||
# successfully created default connection
|
||||
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result)
|
||||
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# get the object of alias
|
||||
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"value_content": Connect_Object_Name})
|
||||
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.value_content: ct.Connect_Object_Name})
|
||||
|
||||
# disconnect alias is exist
|
||||
self.connection_wrap.disconnect(alias=DefaultConfig.DEFAULT_USING)
|
||||
|
||||
# get the object of alias
|
||||
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"value_content": None})
|
||||
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.value_content: None})
|
||||
|
||||
# disconnect twice
|
||||
self.connection_wrap.disconnect(alias=DefaultConfig.DEFAULT_USING)
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': host, 'port': port}})
|
||||
self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': host, 'port': port}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_disconnect_after_connect(self, host, port):
|
||||
"""
|
||||
target: disconnect test connect and check result
|
||||
|
@ -595,31 +595,30 @@ class TestConnectionOperation(TestcaseBase):
|
|||
self.connection_wrap.add_connection(test_alias_name={'host': host, 'port': port})
|
||||
|
||||
# successfully created default connection
|
||||
self.connection_wrap.connect(alias=test_alias_name, host=host, port=port,
|
||||
check_task=CheckTasks.check_connection_result)
|
||||
self.connection_wrap.connect(alias=test_alias_name, host=host, port=port, check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None),
|
||||
(test_alias_name, Connect_Object_Name)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None),
|
||||
(test_alias_name, ct.Connect_Object_Name)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=test_alias_name, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': host, 'port': port}})
|
||||
self.connection_wrap.get_connection_addr(alias=test_alias_name, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': host, 'port': port}})
|
||||
|
||||
# disconnect alias is exist
|
||||
self.connection_wrap.disconnect(alias=test_alias_name)
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None),
|
||||
(test_alias_name, None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None),
|
||||
(test_alias_name, None)]})
|
||||
|
||||
# get all addr of alias and check the response
|
||||
self.connection_wrap.get_connection_addr(alias=test_alias_name, check_task=CheckTasks.check_connection_result,
|
||||
check_items={"dict_content": {'host': host, 'port': port}})
|
||||
self.connection_wrap.get_connection_addr(alias=test_alias_name, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.dict_content: {'host': host, 'port': port}})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_remove_connection_not_exist(self):
|
||||
"""
|
||||
target: remove connection that is not exist and check result
|
||||
|
@ -628,13 +627,13 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# remove the connection that is not exist
|
||||
self.connection_wrap.remove_connection(alias=Not_Exist)
|
||||
self.connection_wrap.remove_connection(alias=ct.Not_Exist)
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None)]})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
def test_connection_remove_default_alias(self):
|
||||
"""
|
||||
target: remove default alias connect and check result
|
||||
|
@ -646,10 +645,9 @@ class TestConnectionOperation(TestcaseBase):
|
|||
self.connection_wrap.remove_connection(alias=DefaultConfig.DEFAULT_USING)
|
||||
|
||||
# list all connections and check the response
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": []})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr, check_items={ct.list_content: []})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
@pytest.mark.parametrize("connect_name", [DefaultConfig.DEFAULT_USING, "test_alias_name"])
|
||||
def test_connection_remove_after_connect(self, host, port, connect_name):
|
||||
"""
|
||||
|
@ -659,23 +657,20 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# successfully created default connection
|
||||
self.connection_wrap.connect(alias=connect_name, host=host, port=port,
|
||||
check_task=CheckTasks.check_connection_result)
|
||||
self.connection_wrap.connect(alias=connect_name, host=host, port=port, check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# remove the connection that is not exist
|
||||
self.connection_wrap.remove_connection(alias=connect_name)
|
||||
|
||||
# get the object of alias
|
||||
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING,
|
||||
check_task=CheckTasks.check_connection_result,
|
||||
check_items={"value_content": None})
|
||||
self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr,
|
||||
check_items={ct.value_content: None})
|
||||
|
||||
# list all connections and check the response
|
||||
list_content = [] if connect_name == DefaultConfig.DEFAULT_USING else [(DefaultConfig.DEFAULT_USING, None)]
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": list_content})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr, check_items={ct.list_content: list_content})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
@pytest.mark.parametrize("connect_name", [DefaultConfig.DEFAULT_USING, "test_alias_name"])
|
||||
def test_connection_remove_after_disconnect(self, host, port, connect_name):
|
||||
"""
|
||||
|
@ -685,8 +680,7 @@ class TestConnectionOperation(TestcaseBase):
|
|||
"""
|
||||
|
||||
# successfully created default connection
|
||||
self.connection_wrap.connect(alias=connect_name, host=host, port=port,
|
||||
check_task=CheckTasks.check_connection_result)
|
||||
self.connection_wrap.connect(alias=connect_name, host=host, port=port, check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# disconnect alias is exist
|
||||
self.connection_wrap.disconnect(alias=connect_name)
|
||||
|
@ -699,5 +693,51 @@ class TestConnectionOperation(TestcaseBase):
|
|||
|
||||
# list all connections and check the response
|
||||
list_content = [] if connect_name == DefaultConfig.DEFAULT_USING else [(DefaultConfig.DEFAULT_USING, None)]
|
||||
self.connection_wrap.list_connections(check_task=CheckTasks.check_connection_result,
|
||||
check_items={"list_content": list_content})
|
||||
self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr, check_items={ct.list_content: list_content})
|
||||
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
@pytest.mark.parametrize("collection_name, schema", [(cf.gen_unique_str('connection_test_'),
|
||||
cf.gen_default_collection_schema())])
|
||||
def test_connection_init_collection_invalid_connection(self, collection_name, schema):
|
||||
"""
|
||||
target: create collection with invalid connection
|
||||
method: init collection with invalid connection
|
||||
expected: check result
|
||||
"""
|
||||
|
||||
# init collection failed
|
||||
self.collection_wrap.init_collection(name=collection_name, schema=schema, check_task=ct.CheckTasks.err_res,
|
||||
check_items={ct.err_code: 0,
|
||||
ct.err_msg: "object has no attribute 'has_collection'"},
|
||||
_using=ct.Not_Exist)
|
||||
|
||||
@pytest.mark.tags(ct.CaseLabel.L1)
|
||||
@pytest.mark.parametrize("collection_name, schema", [(cf.gen_unique_str('connection_test_'),
|
||||
cf.gen_default_collection_schema())])
|
||||
def test_connection_init_collection_connection(self, collection_name, schema, host, port):
|
||||
"""
|
||||
target: create collection then disconnection
|
||||
method: connection, init collection, then disconnection
|
||||
expected: check result
|
||||
"""
|
||||
|
||||
# successfully created default connection
|
||||
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, host=host, port=port,
|
||||
check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# init collection successfully
|
||||
self.collection_wrap.init_collection(name=collection_name, schema=schema, _using=DefaultConfig.DEFAULT_USING)
|
||||
|
||||
# remove connection
|
||||
self.connection_wrap.remove_connection(alias=DefaultConfig.DEFAULT_USING)
|
||||
|
||||
# drop collection failed
|
||||
self.collection_wrap.drop(check_task=ct.CheckTasks.err_res,
|
||||
check_items={ct.err_code: 0, ct.err_msg: "should create connect first"})
|
||||
|
||||
# successfully created default connection
|
||||
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, host=host, port=port,
|
||||
check_task=ct.CheckTasks.ccr)
|
||||
|
||||
# drop collection success
|
||||
self.collection_wrap.drop()
|
||||
|
|
|
@ -8,7 +8,7 @@ class Error:
|
|||
self.message = getattr(error, 'message', str(error))
|
||||
|
||||
|
||||
log_row_length = 150
|
||||
log_row_length = 300
|
||||
|
||||
|
||||
def api_request_catch():
|
||||
|
|
Loading…
Reference in New Issue