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