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

remove disconnect test case (#2183)

* 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>
上级 9b236801
timeout(time: 90, unit: 'MINUTES') {
timeout(time: 120, unit: 'MINUTES') {
dir ("ci/scripts") {
withCredentials([usernamePassword(credentialsId: "${params.JFROG_CREDENTIALS_ID}", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
def checkResult = sh(script: "./check_ccache.sh -l ${params.JFROG_ARTFACTORY_URL}/ccache", returnStatus: true)
......
......@@ -47,24 +47,25 @@ def connect(request):
pytest.exit("Milvus server can not connected, exit pytest ...")
def fin():
try:
milvus.disconnect()
# milvus.disconnect()
pass
except Exception as e:
logging.getLogger().info(str(e))
request.addfinalizer(fin)
return milvus
@pytest.fixture(scope="module")
def dis_connect(request):
ip = request.config.getoption("--ip")
port = request.config.getoption("--port")
http_port = request.config.getoption("--http-port")
handler = request.config.getoption("--handler")
if handler == "HTTP":
port = http_port
milvus = get_milvus(host=ip, port=port, handler=handler)
milvus.disconnect()
return milvus
# @pytest.fixture(scope="module")
# def dis_connect(request):
# ip = request.config.getoption("--ip")
# port = request.config.getoption("--port")
# http_port = request.config.getoption("--http-port")
# handler = request.config.getoption("--handler")
# if handler == "HTTP":
# port = http_port
# milvus = get_milvus(host=ip, port=port, handler=handler)
# milvus.disconnect()
# return milvus
@pytest.fixture(scope="module")
......
......@@ -520,17 +520,17 @@ class TestAddBase:
assert status.OK()
assert len(ids) == nq
@pytest.mark.level(2)
def test_add_vectors_without_connect(self, dis_connect, collection):
'''
target: test add vectors without connection
method: create collection and add vectors in it, check if added successfully
expected: raise exception
'''
nq = 5
vectors = gen_vectors(nq, dim)
with pytest.raises(Exception) as e:
status, ids = dis_connect.add_vectors(collection, vectors)
# @pytest.mark.level(2)
# def test_add_vectors_without_connect(self, dis_connect, collection):
# '''
# target: test add vectors without connection
# method: create collection and add vectors in it, check if added successfully
# expected: raise exception
# '''
# nq = 5
# vectors = gen_vectors(nq, dim)
# with pytest.raises(Exception) as e:
# status, ids = dis_connect.add_vectors(collection, vectors)
def test_add_collection_not_existed(self, connect):
'''
......@@ -1119,17 +1119,17 @@ class TestAddIP:
assert status.OK()
assert len(ids) == nq
@pytest.mark.level(2)
def test_add_vectors_without_connect(self, dis_connect, ip_collection):
'''
target: test add vectors without connection
method: create collection and add vectors in it, check if added successfully
expected: raise exception
'''
nq = 5
vectors = gen_vectors(nq, dim)
with pytest.raises(Exception) as e:
status, ids = dis_connect.add_vectors(ip_collection, vectors)
# @pytest.mark.level(2)
# def test_add_vectors_without_connect(self, dis_connect, ip_collection):
# '''
# target: test add vectors without connection
# method: create collection and add vectors in it, check if added successfully
# expected: raise exception
# '''
# nq = 5
# vectors = gen_vectors(nq, dim)
# with pytest.raises(Exception) as e:
# status, ids = dis_connect.add_vectors(ip_collection, vectors)
def test_add_vector_dim_not_matched(self, connect, ip_collection):
'''
......
......@@ -105,20 +105,20 @@ class TestCollection:
status = connect.create_collection(param)
assert status.OK()
@pytest.mark.level(2)
def test_create_collection_without_connection(self, dis_connect):
'''
target: test create collection, without connection
method: create collection with correct params, with a disconnected instance
expected: create raise exception
'''
collection_name = gen_unique_str("test_collection")
param = {'collection_name': collection_name,
'dimension': dim,
'index_file_size': index_file_size,
'metric_type': MetricType.L2}
with pytest.raises(Exception) as e:
status = dis_connect.create_collection(param)
# @pytest.mark.level(2)
# def test_create_collection_without_connection(self, dis_connect):
# '''
# target: test create collection, without connection
# method: create collection with correct params, with a disconnected instance
# expected: create raise exception
# '''
# collection_name = gen_unique_str("test_collection")
# param = {'collection_name': collection_name,
# 'dimension': dim,
# 'index_file_size': index_file_size,
# 'metric_type': MetricType.L2}
# with pytest.raises(Exception) as e:
# status = dis_connect.create_collection(param)
def test_create_collection_existed(self, connect):
'''
......@@ -342,15 +342,15 @@ class TestCollection:
for p in processes:
p.join()
@pytest.mark.level(2)
def test_collection_describe_without_connection(self, collection, dis_connect):
'''
target: test describe collection, without connection
method: describe collection with correct params, with a disconnected instance
expected: describe raise exception
'''
with pytest.raises(Exception) as e:
status = dis_connect.describe_collection(collection)
# @pytest.mark.level(2)
# def test_collection_describe_without_connection(self, collection, dis_connect):
# '''
# target: test describe collection, without connection
# method: describe collection with correct params, with a disconnected instance
# expected: describe raise exception
# '''
# with pytest.raises(Exception) as e:
# status = dis_connect.describe_collection(collection)
def test_collection_describe_dimension(self, connect):
'''
......@@ -416,15 +416,15 @@ class TestCollection:
status = connect.drop_collection(ham_collection)
assert not assert_has_collection(connect, ham_collection)
@pytest.mark.level(2)
def test_collection_delete_without_connection(self, collection, dis_connect):
'''
target: test describe collection, without connection
method: describe collection with correct params, with a disconnected instance
expected: describe raise exception
'''
with pytest.raises(Exception) as e:
status = dis_connect.drop_collection(collection)
# @pytest.mark.level(2)
# def test_collection_delete_without_connection(self, collection, dis_connect):
# '''
# target: test describe collection, without connection
# method: describe collection with correct params, with a disconnected instance
# expected: describe raise exception
# '''
# with pytest.raises(Exception) as e:
# status = dis_connect.drop_collection(collection)
def test_drop_collection_not_existed(self, connect):
'''
......@@ -437,25 +437,6 @@ class TestCollection:
status = connect.drop_collection(collection_name)
assert not status.OK()
def test_drop_collection_repeatedly(self, connect):
'''
target: test delete collection created with correct params
method: create collection and delete new collection repeatedly,
assert the value returned by delete method
expected: create ok and delete ok
'''
loops = 1
for i in range(loops):
collection_name = gen_unique_str("test_collection")
param = {'collection_name': collection_name,
'dimension': dim,
'index_file_size': index_file_size,
'metric_type': MetricType.L2}
connect.create_collection(param)
status = connect.drop_collection(collection_name)
time.sleep(1)
assert not assert_has_collection(connect, collection_name)
def test_delete_create_collection_repeatedly(self, connect):
'''
target: test delete and create the same collection repeatedly
......@@ -464,6 +445,7 @@ class TestCollection:
expected: create ok and delete ok
'''
loops = 2
timeout = 5
for i in range(loops):
collection_name = "test_collection"
param = {'collection_name': collection_name,
......@@ -471,28 +453,15 @@ class TestCollection:
'index_file_size': index_file_size,
'metric_type': MetricType.L2}
connect.create_collection(param)
status = connect.drop_collection(collection_name)
time.sleep(1)
assert status.OK()
def test_delete_create_collection_repeatedly_ip(self, connect):
'''
target: test delete and create the same collection repeatedly
method: try to create the same collection and delete repeatedly,
assert the value returned by delete method
expected: create ok and delete ok
'''
loops = 2
for i in range(loops):
collection_name = "test_collection"
param = {'collection_name': collection_name,
'dimension': dim,
'index_file_size': index_file_size,
'metric_type': MetricType.IP}
connect.create_collection(param)
status = connect.drop_collection(collection_name)
time.sleep(1)
assert status.OK()
status = None
while i < timeout:
status = connect.drop_collection(collection_name)
time.sleep(1)
i += 1
if status.OK():
break
if i > timeout:
assert False
# TODO: enable
@pytest.mark.level(2)
......@@ -623,15 +592,15 @@ class TestCollection:
connect.create_collection(param)
assert assert_has_collection(connect, collection_name)
@pytest.mark.level(2)
def test_has_collection_without_connection(self, collection, dis_connect):
'''
target: test has collection, without connection
method: calling has collection with correct params, with a disconnected instance
expected: has collection raise exception
'''
with pytest.raises(Exception) as e:
assert_has_collection(dis_connect, collection)
# @pytest.mark.level(2)
# def test_has_collection_without_connection(self, collection, dis_connect):
# '''
# target: test has collection, without connection
# method: calling has collection with correct params, with a disconnected instance
# expected: has collection raise exception
# '''
# with pytest.raises(Exception) as e:
# assert_has_collection(dis_connect, collection)
def test_has_collection_not_existed(self, connect):
'''
......@@ -745,15 +714,15 @@ class TestCollection:
assert status.OK()
assert collection_name in result
@pytest.mark.level(2)
def test_show_collections_without_connection(self, dis_connect):
'''
target: test show_collections, without connection
method: calling show_collections with correct params, with a disconnected instance
expected: show_collections raise exception
'''
with pytest.raises(Exception) as e:
status = dis_connect.show_collections()
# @pytest.mark.level(2)
# def test_show_collections_without_connection(self, dis_connect):
# '''
# target: test show_collections, without connection
# method: calling show_collections with correct params, with a disconnected instance
# expected: show_collections raise exception
# '''
# with pytest.raises(Exception) as e:
# status = dis_connect.show_collections()
@pytest.mark.level(2)
def test_show_collections_no_collection(self, connect):
......
......@@ -145,15 +145,15 @@ class TestCollectionCount:
status, res = connect.count_collection(collection)
assert res == nb
@pytest.mark.level(2)
def test_count_without_connection(self, collection, dis_connect):
'''
target: test count_collection, without connection
method: calling count_collection with correct params, with a disconnected instance
expected: count_collection raise exception
'''
with pytest.raises(Exception) as e:
status = dis_connect.count_collection(collection)
# @pytest.mark.level(2)
# def test_count_without_connection(self, collection, dis_connect):
# '''
# target: test count_collection, without connection
# method: calling count_collection with correct params, with a disconnected instance
# expected: count_collection raise exception
# '''
# with pytest.raises(Exception) as e:
# status = dis_connect.count_collection(collection)
def test_collection_rows_count_no_vectors(self, connect, collection):
'''
......@@ -289,15 +289,15 @@ class TestCollectionCountIP:
status, res = connect.count_collection(ip_collection)
assert res == nb
@pytest.mark.level(2)
def test_count_without_connection(self, ip_collection, dis_connect):
'''
target: test count_collection, without connection
method: calling count_collection with correct params, with a disconnected instance
expected: count_collection raise exception
'''
with pytest.raises(Exception) as e:
status = dis_connect.count_collection(ip_collection)
# @pytest.mark.level(2)
# def test_count_without_connection(self, ip_collection, dis_connect):
# '''
# target: test count_collection, without connection
# method: calling count_collection with correct params, with a disconnected instance
# expected: count_collection raise exception
# '''
# with pytest.raises(Exception) as e:
# status = dis_connect.count_collection(ip_collection)
def test_collection_rows_count_no_vectors(self, connect, ip_collection):
'''
......@@ -431,15 +431,15 @@ class TestCollectionCountJAC:
status, res = connect.count_collection(jac_collection)
assert res == nb
@pytest.mark.level(2)
def test_count_without_connection(self, jac_collection, dis_connect):
'''
target: test count_collection, without connection
method: calling count_collection with correct params, with a disconnected instance
expected: count_collection raise exception
'''
with pytest.raises(Exception) as e:
status = dis_connect.count_collection(jac_collection)
# @pytest.mark.level(2)
# def test_count_without_connection(self, jac_collection, dis_connect):
# '''
# target: test count_collection, without connection
# method: calling count_collection with correct params, with a disconnected instance
# expected: count_collection raise exception
# '''
# with pytest.raises(Exception) as e:
# status = dis_connect.count_collection(jac_collection)
def test_collection_rows_count_no_vectors(self, connect, jac_collection):
'''
......@@ -624,15 +624,15 @@ class TestCollectionCountBinary:
status, res = connect.count_collection(superstructure_collection)
assert res == nb
@pytest.mark.level(2)
def test_count_without_connection(self, ham_collection, dis_connect):
'''
target: test count_collection, without connection
method: calling count_collection with correct params, with a disconnected instance
expected: count_collection raise exception
'''
with pytest.raises(Exception) as e:
status = dis_connect.count_collection(ham_collection)
# @pytest.mark.level(2)
# def test_count_without_connection(self, ham_collection, dis_connect):
# '''
# target: test count_collection, without connection
# method: calling count_collection with correct params, with a disconnected instance
# expected: count_collection raise exception
# '''
# with pytest.raises(Exception) as e:
# status = dis_connect.count_collection(ham_collection)
def test_collection_rows_count_no_vectors(self, connect, ham_collection):
'''
......
......@@ -18,30 +18,30 @@ class TestConnect:
else:
return False
def test_disconnect(self, connect):
'''
target: test disconnect
method: disconnect a connected client
expected: connect failed after disconnected
'''
res = connect.disconnect()
assert res.OK()
with pytest.raises(Exception) as e:
res = connect.server_version()
def test_disconnect_repeatedly(self, connect, args):
'''
target: test disconnect repeatedly
method: disconnect a connected client, disconnect again
expected: raise an error after disconnected
'''
if not connect.connected():
with pytest.raises(Exception) as e:
connect.disconnect()
else:
connect.disconnect()
with pytest.raises(Exception) as e:
connect.disconnect()
# def test_disconnect(self, connect):
# '''
# target: test disconnect
# method: disconnect a connected client
# expected: connect failed after disconnected
# '''
# res = connect.disconnect()
# assert res.OK()
# with pytest.raises(Exception) as e:
# res = connect.server_version()
# def test_disconnect_repeatedly(self, connect, args):
# '''
# target: test disconnect repeatedly
# method: disconnect a connected client, disconnect again
# expected: raise an error after disconnected
# '''
# if not connect.connected():
# with pytest.raises(Exception) as e:
# connect.disconnect()
# else:
# connect.disconnect()
# with pytest.raises(Exception) as e:
# connect.disconnect()
def test_connect_correct_ip_port(self, args):
'''
......@@ -147,17 +147,17 @@ class TestConnect:
milvus.connect(uri=uri_value, timeout=5)
assert milvus.connected()
def test_connect_disconnect_repeatedly_times(self, args):
'''
target: test connect and disconnect for 10 times repeatedly
method: disconnect, and then connect, assert connect status
expected: status.code is 0
'''
times = 10
for i in range(times):
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
milvus.disconnect()
assert not milvus.connected()
# def test_connect_disconnect_repeatedly_times(self, args):
# '''
# target: test connect and disconnect for 10 times repeatedly
# method: disconnect, and then connect, assert connect status
# expected: status.code is 0
# '''
# times = 10
# for i in range(times):
# milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
# milvus.disconnect()
# assert not milvus.connected()
# TODO: enable
def _test_connect_disconnect_with_multiprocess(self, args):
......
......@@ -136,6 +136,7 @@ class TestFlushBase:
status, res = connect.search_vectors(collection, top_k, query_records=query_vecs)
assert status.OK()
# TODO: stable case
def test_add_flush_auto(self, connect, collection):
'''
method: add vectors
......@@ -145,10 +146,16 @@ class TestFlushBase:
ids = [i for i in range(nb)]
status, ids = connect.add_vectors(collection, vectors, ids)
assert status.OK()
time.sleep(2)
status, res = connect.count_collection(collection)
assert status.OK()
assert res == nb
timeout = 10
start_time = time.time()
while (time.time()-start_time < timeout):
time.sleep(1)
status, res = connect.count_collection(collection)
if res == nb:
assert status.OK()
break
if time.time()-start_time > timeout:
assert False
@pytest.fixture(
scope="function",
......@@ -160,7 +167,6 @@ class TestFlushBase:
def same_ids(self, request):
yield request.param
# both autoflush / flush
def test_add_flush_same_ids(self, connect, collection, same_ids):
'''
method: add vectors, with same ids, count(same ids) < 15, > 15
......@@ -172,7 +178,6 @@ class TestFlushBase:
if item <= same_ids:
ids[i] = 0
status, ids = connect.add_vectors(collection, vectors, ids)
time.sleep(2)
status = connect.flush([collection])
assert status.OK()
status, res = connect.count_collection(collection)
......
......@@ -242,8 +242,6 @@ class TestGetIndexedVectors:
id = get_id
status, res = connect.get_vectors_by_ids(collection, [ids[id]])
assert status.OK()
logging.getLogger().info(res)
assert status.OK()
assert_equal_vector(res[0], vectors[id])
def test_get_vector_after_delete(self, connect, collection, get_simple_index, get_id):
......
......@@ -116,18 +116,18 @@ class TestIndexBase:
status = connect.create_index(collection, index_type, index_param)
assert status.OK()
@pytest.mark.level(2)
def test_create_index_without_connect(self, dis_connect, collection):
'''
target: test create index without connection
method: create collection and add vectors in it, check if added successfully
expected: raise exception
'''
nlist = NLIST
index_type = IndexType.IVF_SQ8
index_param = {"nlist": nlist}
with pytest.raises(Exception) as e:
status = dis_connect.create_index(collection, index_type, index_param)
# @pytest.mark.level(2)
# def test_create_index_without_connect(self, dis_connect, collection):
# '''
# target: test create index without connection
# method: create collection and add vectors in it, check if added successfully
# expected: raise exception
# '''
# nlist = NLIST
# index_type = IndexType.IVF_SQ8
# index_param = {"nlist": nlist}
# with pytest.raises(Exception) as e:
# status = dis_connect.create_index(collection, index_type, index_param)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_search_with_query_vectors(self, connect, collection, get_simple_index):
......@@ -483,15 +483,15 @@ class TestIndexBase:
assert result._collection_name == collection_list[i]
assert result._index_type == IndexType.FLAT
@pytest.mark.level(2)
def test_describe_index_without_connect(self, dis_connect, collection):
'''
target: test describe index without connection
method: describe index, and check if describe successfully
expected: raise exception
'''
with pytest.raises(Exception) as e:
status = dis_connect.describe_index(collection)
# @pytest.mark.level(2)
# def test_describe_index_without_connect(self, dis_connect, collection):
# '''
# target: test describe index without connection
# method: describe index, and check if describe successfully
# expected: raise exception
# '''
# with pytest.raises(Exception) as e:
# status = dis_connect.describe_index(collection)
def test_describe_index_collection_not_existed(self, connect):
'''
......@@ -578,15 +578,15 @@ class TestIndexBase:
assert result._collection_name == collection
assert result._index_type == IndexType.FLAT
@pytest.mark.level(2)
def test_drop_index_without_connect(self, dis_connect, collection):
'''
target: test drop index without connection
method: drop index, and check if drop successfully
expected: raise exception
'''
with pytest.raises(Exception) as e:
status = dis_connect.drop_index(collection)
# @pytest.mark.level(2)
# def test_drop_index_without_connect(self, dis_connect, collection):
# '''
# target: test drop index without connection
# method: drop index, and check if drop successfully
# expected: raise exception
# '''
# with pytest.raises(Exception) as e:
# status = dis_connect.drop_index(collection)
def test_drop_index_collection_not_existed(self, connect):
'''
......@@ -732,18 +732,18 @@ class TestIndexIP:
status = connect.create_index(ip_collection, index_type, index_param)
assert status.OK()
@pytest.mark.level(2)
def test_create_index_without_connect(self, dis_connect, ip_collection):
'''
target: test create index without connection
method: create collection and add vectors in it, check if added successfully
expected: raise exception
'''
nlist = NLIST
index_type = IndexType.IVF_SQ8
index_param = {"nlist": nlist}
with pytest.raises(Exception) as e:
status = dis_connect.create_index(ip_collection, index_type, index_param)
# @pytest.mark.level(2)
# def test_create_index_without_connect(self, dis_connect, ip_collection):
# '''
# target: test create index without connection
# method: create collection and add vectors in it, check if added successfully
# expected: raise exception
# '''
# nlist = NLIST
# index_type = IndexType.IVF_SQ8
# index_param = {"nlist": nlist}
# with pytest.raises(Exception) as e:
# status = dis_connect.create_index(ip_collection, index_type, index_param)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_search_with_query_vectors(self, connect, ip_collection, get_simple_index):
......@@ -1020,15 +1020,15 @@ class TestIndexIP:
assert result._collection_name == collection_list[i]
assert result._index_type == IndexType.FLAT
@pytest.mark.level(2)
def test_describe_index_without_connect(self, dis_connect, ip_collection):
'''
target: test describe index without connection
method: describe index, and check if describe successfully
expected: raise exception
'''
with pytest.raises(Exception) as e:
status = dis_connect.describe_index(ip_collection)
# @pytest.mark.level(2)
# def test_describe_index_without_connect(self, dis_connect, ip_collection):
# '''
# target: test describe index without connection
# method: describe index, and check if describe successfully
# expected: raise exception
# '''
# with pytest.raises(Exception) as e:
# status = dis_connect.describe_index(ip_collection)
def test_describe_index_not_create(self, connect, ip_collection):
'''
......@@ -1147,18 +1147,18 @@ class TestIndexIP:
assert result._collection_name == ip_collection
assert result._index_type == IndexType.FLAT
@pytest.mark.level(2)
def test_drop_index_without_connect(self, dis_connect, ip_collection):
'''
target: test drop index without connection
method: drop index, and check if drop successfully
expected: raise exception
'''
nlist = NLIST
index_type = IndexType.IVFLAT
index_param = {"nlist": nlist}
with pytest.raises(Exception) as e:
status = dis_connect.drop_index(ip_collection, index_type, index_param)
# @pytest.mark.level(2)
# def test_drop_index_without_connect(self, dis_connect, ip_collection):
# '''
# target: test drop index without connection
# method: drop index, and check if drop successfully
# expected: raise exception
# '''
# nlist = NLIST
# index_type = IndexType.IVFLAT
# index_param = {"nlist": nlist}
# with pytest.raises(Exception) as e:
# status = dis_connect.drop_index(ip_collection, index_type, index_param)
def test_drop_index_collection_not_create(self, connect, ip_collection):
'''
......@@ -1299,17 +1299,17 @@ class TestIndexJAC:
status = connect.create_index(jac_collection, index_type, index_param)
assert status.OK()
@pytest.mark.level(2)
def test_create_index_without_connect(self, dis_connect, jac_collection):
'''
target: test create index without connection
method: create collection and add vectors in it, check if added successfully
expected: raise exception
'''
nlist = NLIST
index_param = {"nlist": nlist}
with pytest.raises(Exception) as e:
status = dis_connect.create_index(jac_collection, IndexType.IVF_SQ8, index_param)
# @pytest.mark.level(2)
# def test_create_index_without_connect(self, dis_connect, jac_collection):
# '''
# target: test create index without connection
# method: create collection and add vectors in it, check if added successfully
# expected: raise exception
# '''
# nlist = NLIST
# index_param = {"nlist": nlist}
# with pytest.raises(Exception) as e:
# status = dis_connect.create_index(jac_collection, IndexType.IVF_SQ8, index_param)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_search_with_query_vectors(self, connect, jac_collection, get_jaccard_index):
......@@ -1539,17 +1539,17 @@ class TestIndexBinary:
status, res = connect.count_collection(substructure_collection,)
assert res == len(self.vectors)
@pytest.mark.level(2)
def test_create_index_without_connect(self, dis_connect, ham_collection):
'''
target: test create index without connection
method: create collection and add vectors in it, check if added successfully
expected: raise exception
'''
nlist = NLIST
index_param = {"nlist": nlist}
with pytest.raises(Exception) as e:
status = dis_connect.create_index(ham_collection, IndexType.IVF_SQ8, index_param)
# @pytest.mark.level(2)
# def test_create_index_without_connect(self, dis_connect, ham_collection):
# '''
# target: test create index without connection
# method: create collection and add vectors in it, check if added successfully
# expected: raise exception
# '''
# nlist = NLIST
# index_param = {"nlist": nlist}
# with pytest.raises(Exception) as e:
# status = dis_connect.create_index(ham_collection, IndexType.IVF_SQ8, index_param)
@pytest.mark.timeout(BUILD_TIMEOUT)
def test_create_index_search_with_query_vectors(self, connect, ham_collection, get_hamming_index):
......
......@@ -53,25 +53,25 @@ class TestPing:
assert connect.connected()
class TestPingDisconnect:
def test_server_version(self, dis_connect):
'''
target: test get the server version, after disconnect
method: call the server_version method after connected
expected: version should not be the pymilvus version
'''
res = None
with pytest.raises(Exception) as e:
status, res = connect.server_version()
assert res is None
def test_server_status(self, dis_connect):
'''
target: test get the server status, after disconnect
method: call the server_status method after connected
expected: status returned should be not ok
'''
status = None
with pytest.raises(Exception) as e:
status, msg = connect.server_status()
assert status is None
# class TestPingDisconnect:
# def test_server_version(self, dis_connect):
# '''
# target: test get the server version, after disconnect
# method: call the server_version method after connected
# expected: version should not be the pymilvus version
# '''
# res = None
# with pytest.raises(Exception) as e:
# status, res = connect.server_version()
# assert res is None
#
# def test_server_status(self, dis_connect):
# '''
# target: test get the server status, after disconnect
# method: call the server_status method after connected
# expected: status returned should be not ok
# '''
# status = None
# with pytest.raises(Exception) as e:
# status, msg = connect.server_status()
# assert status is None
......@@ -368,15 +368,15 @@ class TestSearchBase:
assert result[i][0].distance <= epsilon
assert check_result(result[i], ids[i])
def test_search_by_ids_without_connect(self, dis_connect, collection):
'''
target: test search vectors without connection
method: use dis connected instance, call search method and check if search successfully
expected: raise exception
'''
query_ids = [1]
with pytest.raises(Exception) as e:
status, ids = dis_connect.search_by_ids(collection, query_ids, top_k, params={})
# def test_search_by_ids_without_connect(self, dis_connect, collection):
# '''
# target: test search vectors without connection
# method: use dis connected instance, call search method and check if search successfully
# expected: raise exception
# '''
# query_ids = [1]
# with pytest.raises(Exception) as e:
# status, ids = dis_connect.search_by_ids(collection, query_ids, top_k, params={})
def test_search_collection_name_not_existed(self, connect, collection):
'''
......
......@@ -505,17 +505,17 @@ class TestSearchBase:
assert check_result(result[0], ids[0])
assert result[0][0].distance >= 1 - gen_inaccuracy(result[0][0].distance)
@pytest.mark.level(2)
def test_search_vectors_without_connect(self, dis_connect, collection):
'''
target: test search vectors without connection
method: use dis connected instance, call search method and check if search successfully
expected: raise exception
'''
query_vectors = [vectors[0]]
nprobe = 1
with pytest.raises(Exception) as e:
status, ids = dis_connect.search_vectors(collection, top_k, query_vectors)
# @pytest.mark.level(2)
# def test_search_vectors_without_connect(self, dis_connect, collection):
# '''
# target: test search vectors without connection
# method: use dis connected instance, call search method and check if search successfully
# expected: raise exception
# '''
# query_vectors = [vectors[0]]
# nprobe = 1
# with pytest.raises(Exception) as e:
# status, ids = dis_connect.search_vectors(collection, top_k, query_vectors)
def test_search_collection_name_not_existed(self, connect, collection):
'''
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册