未验证 提交 6283ee1b 编写于 作者: D del-zhenwu 提交者: GitHub

Remove connect (#2193)

* remove disconnect test case
Signed-off-by: Nzw <zw@zilliz.com>

* stable case
Signed-off-by: Nzw <zw@zilliz.com>

* re-trigger
Signed-off-by: Nzw <zw@zilliz.com>

* update cases
Signed-off-by: Nzw <zw@zilliz.com>
上级 2c889636
......@@ -601,12 +601,11 @@ class TestAddBase:
processes = []
def add():
milvus = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"])
milvus.connect(uri=uri)
i = 0
while i < loop_num:
status, ids = milvus.add_vectors(collection, vector)
i = i + 1
milvus.disconnect()
# milvus.disconnect()
for i in range(process_num):
p = Process(target=add, args=())
processes.append(p)
......
......@@ -50,7 +50,7 @@ class TestConnect:
expected: connected is True
'''
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
assert milvus.connected()
# assert milvus.connected()
def test_connect_connected(self, args):
'''
......@@ -59,8 +59,9 @@ class TestConnect:
expected: connected is False
'''
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
milvus.disconnect()
assert not milvus.connected()
# milvus.disconnect()
# assert not milvus.connected()
assert milvus
# TODO: Currently we test with remote IP, localhost testing need to add
def _test_connect_ip_localhost(self, args):
......@@ -70,8 +71,8 @@ class TestConnect:
expected: connected is True
'''
milvus = get_milvus(args["ip"], args["port"], args["handler"])
milvus.connect(host='localhost', port=args["port"])
assert milvus.connected()
# milvus.connect(host='localhost', port=args["port"])
# assert milvus.connected()
@pytest.mark.timeout(CONNECT_TIMEOUT)
def test_connect_wrong_ip_null(self, args):
......@@ -83,7 +84,7 @@ class TestConnect:
ip = ""
with pytest.raises(Exception) as e:
milvus = get_milvus(ip, args["port"], args["handler"])
assert not milvus.connected()
# assert not milvus.connected()
def test_connect_uri(self, args):
'''
......@@ -93,7 +94,7 @@ class TestConnect:
'''
uri_value = "tcp://%s:%s" % (args["ip"], args["port"])
milvus = get_milvus(args["ip"], args["port"], uri=uri_value, handler=args["handler"])
assert milvus.connected()
# assert milvus.connected()
def test_connect_uri_null(self, args):
'''
......@@ -104,36 +105,36 @@ class TestConnect:
uri_value = ""
if self.local_ip(args):
milvus = get_milvus(uri=uri_value, handler=args["handler"])
assert milvus.connected()
# assert milvus.connected()
else:
with pytest.raises(Exception) as e:
milvus = get_milvus(uri=uri_value, handler=args["handler"])
assert not milvus.connected()
# assert not milvus.connected()
# disable
def _test_connect_with_multiprocess(self, args):
'''
target: test uri connect with multiprocess
method: set correct uri, test with multiprocessing connecting
expected: all connection is connected
'''
uri_value = "tcp://%s:%s" % (args["ip"], args["port"])
process_num = 10
processes = []
# def _test_connect_with_multiprocess(self, args):
# '''
# target: test uri connect with multiprocess
# method: set correct uri, test with multiprocessing connecting
# expected: all connection is connected
# '''
# uri_value = "tcp://%s:%s" % (args["ip"], args["port"])
# process_num = 10
# processes = []
def connect(milvus):
milvus.connect(uri=uri_value)
with pytest.raises(Exception) as e:
milvus.connect(uri=uri_value)
assert milvus.connected()
# def connect(milvus):
# milvus.connect(uri=uri_value)
# with pytest.raises(Exception) as e:
# milvus.connect(uri=uri_value)
# # assert milvus.connected()
for i in range(process_num):
milvus = get_milvus(args["ip"], args["port"], args["handler"])
p = Process(target=connect, args=(milvus, ))
processes.append(p)
p.start()
for p in processes:
p.join()
# for i in range(process_num):
# milvus = get_milvus(args["ip"], args["port"], args["handler"])
# p = Process(target=connect, args=(milvus, ))
# processes.append(p)
# p.start()
# for p in processes:
# p.join()
def test_connect_repeatedly(self, args):
'''
......@@ -143,9 +144,10 @@ class TestConnect:
'''
uri_value = "tcp://%s:%s" % (args["ip"], args["port"])
milvus = Milvus(uri=uri_value, handler=args["handler"])
milvus.connect(uri=uri_value, timeout=5)
milvus.connect(uri=uri_value, timeout=5)
assert milvus.connected()
# milvus.connect(uri=uri_value, timeout=5)
# milvus.connect(uri=uri_value, timeout=5)
milvus = Milvus(uri=uri_value, handler=args["handler"])
# assert milvus.connected()
# def test_connect_disconnect_repeatedly_times(self, args):
# '''
......@@ -160,43 +162,43 @@ class TestConnect:
# assert not milvus.connected()
# TODO: enable
def _test_connect_disconnect_with_multiprocess(self, args):
'''
target: test uri connect and disconnect repeatly with multiprocess
method: set correct uri, test with multiprocessing connecting and disconnecting
expected: all connection is connected after 10 times operation
'''
uri_value = "tcp://%s:%s" % (args["ip"], args["port"])
process_num = 4
processes = []
def connect(milvus):
milvus.connect(uri=uri_value)
milvus.disconnect()
milvus.connect(uri=uri_value)
assert milvus.connected()
for i in range(process_num):
milvus = get_milvus(args["ip"], args["port"], args["handler"])
p = Process(target=connect, args=(milvus, ))
processes.append(p)
p.start()
for p in processes:
p.join()
# def _test_connect_disconnect_with_multiprocess(self, args):
# '''
# target: test uri connect and disconnect repeatly with multiprocess
# method: set correct uri, test with multiprocessing connecting and disconnecting
# expected: all connection is connected after 10 times operation
# '''
# uri_value = "tcp://%s:%s" % (args["ip"], args["port"])
# process_num = 4
# processes = []
# def connect(milvus):
# milvus.connect(uri=uri_value)
# milvus.disconnect()
# milvus.connect(uri=uri_value)
# assert milvus.connected()
# for i in range(process_num):
# milvus = get_milvus(args["ip"], args["port"], args["handler"])
# p = Process(target=connect, args=(milvus, ))
# processes.append(p)
# p.start()
# for p in processes:
# p.join()
# Disable, (issue: https://github.com/milvus-io/milvus/issues/288)
def _test_connect_param_priority_both_hostip_uri(self, args):
'''
target: both host_ip_port / uri are both given, and not null, use the uri params
method: check if wrong uri connection is ok
expected: connect raise an exception and connected is false
'''
milvus = get_milvus(args["ip"], args["port"], args["handler"])
uri_value = "tcp://%s:%s" % (args["ip"], args["port"])
with pytest.raises(Exception) as e:
res = milvus.connect(host=args["ip"], port=39540, uri=uri_value, timeout=1)
logging.getLogger().info(res)
# assert not milvus.connected()
# def _test_connect_param_priority_both_hostip_uri(self, args):
# '''
# target: both host_ip_port / uri are both given, and not null, use the uri params
# method: check if wrong uri connection is ok
# expected: connect raise an exception and connected is false
# '''
# milvus = get_milvus(args["ip"], args["port"], args["handler"])
# uri_value = "tcp://%s:%s" % (args["ip"], args["port"])
# with pytest.raises(Exception) as e:
# res = milvus.connect(host=args["ip"], port=39540, uri=uri_value, timeout=1)
# logging.getLogger().info(res)
# # assert not milvus.connected()
def _test_add_vector_and_disconnect_concurrently(self):
'''
......@@ -250,7 +252,7 @@ class TestConnectIPInvalid(object):
ip = get_invalid_ip
with pytest.raises(Exception) as e:
milvus = get_milvus(ip, args["port"], args["handler"])
assert not milvus.connected()
# assert not milvus.connected()
class TestConnectPortInvalid(object):
......@@ -276,7 +278,7 @@ class TestConnectPortInvalid(object):
port = get_invalid_port
with pytest.raises(Exception) as e:
milvus = get_milvus(args["ip"], port, args["handler"])
assert not milvus.connected()
# assert not milvus.connected()
class TestConnectURIInvalid(object):
......@@ -301,4 +303,4 @@ class TestConnectURIInvalid(object):
uri_value = get_invalid_uri
with pytest.raises(Exception) as e:
milvus = get_milvus(uri=uri_value, handler=args["handler"])
assert not milvus.connected()
# assert not milvus.connected()
......@@ -34,7 +34,7 @@ class TestMixBase:
uri = "tcp://%s:%s" % (args["ip"], args["port"])
id_0 = 0; id_1 = 0
milvus_instance = get_milvus(args["handler"])
milvus_instance.connect(uri=uri)
# milvus_instance.connect(uri=uri)
milvus_instance.create_collection({'collection_name': collection,
'dimension': dim,
'index_file_size': index_file_size,
......@@ -62,11 +62,11 @@ class TestMixBase:
assert result[0][0].id == id_0
assert result[1][0].id == id_1
milvus_instance = get_milvus(args["handler"])
milvus_instance.connect(uri=uri)
# milvus_instance.connect(uri=uri)
p_search = Process(target=search, args=(milvus_instance, ))
p_search.start()
milvus_instance = get_milvus(args["handler"])
milvus_instance.connect(uri=uri)
# milvus_instance.connect(uri=uri)
p_create = Process(target=add_vectors, args=(milvus_instance, ))
p_create.start()
p_create.join()
......
......@@ -50,7 +50,8 @@ class TestPing:
# assert msg == __version__
def test_connected(self, connect):
assert connect.connected()
# assert connect.connected()
assert connect
# class TestPingDisconnect:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册