mirror of https://github.com/milvus-io/milvus.git
[skip ci] disable ubuntu && update case (#3244)
* [skip ci] disable ubuntu && update case Signed-off-by: zw <zw@milvus.io> * some cases set level-1 from level-2 Signed-off-by: zw <zw@milvus.io> * add get collection info case: after index created Signed-off-by: zw <zw@milvus.io> * add -1 in invalid ints Signed-off-by: zw <zw@milvus.io> * remove douban pip during install python-lib Signed-off-by: zw <zw@milvus.io> Co-authored-by: zw <zw@milvus.io>pull/3264/head
parent
4beb05499d
commit
0dfe08471b
|
@ -25,7 +25,8 @@ timeout(time: 120, unit: 'MINUTES') {
|
|||
}
|
||||
|
||||
dir ("tests/milvus_python_test") {
|
||||
sh 'python3 -m pip install -r requirements.txt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com'
|
||||
// sh 'python3 -m pip install -r requirements.txt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com'
|
||||
sh 'python3 -m pip install -r requirements.txt'
|
||||
if (isTimeTriggeredBuild()) {
|
||||
sh "pytest . --alluredir=\"test_out/dev/single/mysql\" --level=2 --ip ${env.HELM_RELEASE_NAME}.milvus.svc.cluster.local --service ${env.HELM_RELEASE_NAME} >> ${WORKSPACE}/${env.DEV_TEST_ARTIFACTS}/milvus_${BINARY_VERSION}_mysql_dev_test.log"
|
||||
} else {
|
||||
|
|
|
@ -301,6 +301,7 @@ class TestStatsBase:
|
|||
assert stats["partitions"][0]["segments"][0]["row_count"] == nb
|
||||
connect.drop_collection(collection_list[i])
|
||||
|
||||
@pytest.mark.level(2)
|
||||
def test_collection_count_multi_collections_indexed(self, connect):
|
||||
'''
|
||||
target: test collection rows_count is correct or not with multiple collections of L2
|
||||
|
|
|
@ -10,6 +10,7 @@ from utils import *
|
|||
collection_id = "info"
|
||||
default_fields = gen_default_fields()
|
||||
segment_row_count = 5000
|
||||
field_name = "float_vector"
|
||||
|
||||
|
||||
class TestInfoBase:
|
||||
|
@ -35,6 +36,17 @@ class TestInfoBase:
|
|||
def get_segment_row_count(self, request):
|
||||
yield request.param
|
||||
|
||||
@pytest.fixture(
|
||||
scope="function",
|
||||
params=gen_simple_index()
|
||||
)
|
||||
def get_simple_index(self, request, connect):
|
||||
logging.getLogger().info(request.param)
|
||||
if str(connect._cmd("mode")) == "CPU":
|
||||
if request.param["index_type"] in index_cpu_not_support():
|
||||
pytest.skip("sq8h not support in CPU mode")
|
||||
return request.param
|
||||
|
||||
"""
|
||||
******************************************************************
|
||||
The following cases are used to test `get_collection_info` function, no data in collection
|
||||
|
@ -76,6 +88,14 @@ class TestInfoBase:
|
|||
connect.create_collection(collection_name, fields)
|
||||
# assert segment size
|
||||
|
||||
def test_get_collection_info_after_index_created(self, connect, collection, get_simple_index):
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
res = connect.get_collection_info(collection)
|
||||
for field in res["fields"]:
|
||||
if field["field"] == field_name:
|
||||
index = field["indexes"][0]
|
||||
assert index["index_type"] == get_simple_index["index_type"]
|
||||
assert index["metric_type"] == get_simple_index["metric_type"]
|
||||
|
||||
@pytest.mark.level(2)
|
||||
def test_get_collection_info_without_connection(self, collection, dis_connect):
|
||||
|
@ -98,6 +118,7 @@ class TestInfoBase:
|
|||
with pytest.raises(Exception) as e:
|
||||
res = connect.get_collection_info(connect, collection_name)
|
||||
|
||||
@pytest.mark.level(2)
|
||||
def test_get_collection_info_multithread(self, connect):
|
||||
'''
|
||||
target: test create collection with multithread
|
||||
|
|
|
@ -34,7 +34,7 @@ class TestListCollections:
|
|||
method: create collection, assert the value returned by list_collections method
|
||||
expected: True
|
||||
'''
|
||||
collection_num = 100
|
||||
collection_num = 50
|
||||
for i in range(collection_num):
|
||||
collection_name = gen_unique_str(collection_id)
|
||||
connect.create_collection(collection_name, default_fields)
|
||||
|
@ -60,6 +60,7 @@ class TestListCollections:
|
|||
collection_name = gen_unique_str(collection_id)
|
||||
assert collection_name not in connect.list_collections()
|
||||
|
||||
@pytest.mark.level(2)
|
||||
def test_list_collections_no_collection(self, connect):
|
||||
'''
|
||||
target: test show collections is correct or not, if no collection in db
|
||||
|
|
|
@ -42,6 +42,21 @@ class TestLoadCollection:
|
|||
connect.create_index(collection, field_name, get_simple_index)
|
||||
connect.load_collection(collection)
|
||||
|
||||
# TODO:
|
||||
@pytest.mark.level(1)
|
||||
def test_load_collection_after_index_binary(self, connect, binary_collection):
|
||||
'''
|
||||
target: test load binary_collection, after index created
|
||||
method: insert and create index, load binary_collection with correct params
|
||||
expected: describe raise exception
|
||||
'''
|
||||
# connect.insert(binary_collection, entities)
|
||||
# connect.flush([binary_collection])
|
||||
# logging.getLogger().info(get_simple_index)
|
||||
# connect.create_index(binary_collection, field_name, get_simple_index)
|
||||
# connect.load_collection(binary_collection)
|
||||
pass
|
||||
|
||||
def load_empty_collection(self, connect, collection):
|
||||
'''
|
||||
target: test load collection
|
||||
|
@ -50,7 +65,7 @@ class TestLoadCollection:
|
|||
'''
|
||||
connect.load_collection(collection)
|
||||
|
||||
@pytest.mark.level(1)
|
||||
@pytest.mark.level(2)
|
||||
def test_load_collection_dis_connect(self, dis_connect, collection):
|
||||
'''
|
||||
target: test load collection, without connection
|
||||
|
@ -66,6 +81,15 @@ class TestLoadCollection:
|
|||
with pytest.raises(Exception) as e:
|
||||
connect.load_collection(collection_name)
|
||||
|
||||
# TODO:
|
||||
@pytest.mark.level(2)
|
||||
def test_load_collection_after_search(self, connect, collection):
|
||||
pass
|
||||
|
||||
@pytest.mark.level(2)
|
||||
def test_load_collection_before_search(self, connect, collection):
|
||||
pass
|
||||
|
||||
|
||||
class TestLoadCollectionInvalid(object):
|
||||
"""
|
||||
|
|
|
@ -290,6 +290,7 @@ class TestDeleteBase:
|
|||
res_get = connect.get_entity_by_id(collection, delete_ids)
|
||||
assert res_get[0] is None
|
||||
|
||||
@pytest.mark.level(2)
|
||||
def test_index_insert_single_delete_get(self, connect, id_collection, get_simple_index):
|
||||
'''
|
||||
method: create index, insert entities, and delete
|
||||
|
|
|
@ -261,6 +261,7 @@ class TestGetBase:
|
|||
for i in range(get_pos, get_pos*2):
|
||||
assert_equal_vector(res[i].get(default_float_vec_field_name), new_entities[-1]["values"][i-get_pos])
|
||||
|
||||
@pytest.mark.level(2)
|
||||
def test_get_entities_indexed_tag(self, connect, collection, get_simple_index, get_pos):
|
||||
'''
|
||||
target: test.get_entity_by_id
|
||||
|
@ -427,6 +428,7 @@ class TestGetBase:
|
|||
for i in range(get_pos):
|
||||
assert_equal_vector(res[i].get(default_float_vec_field_name), entities[-1]["values"][i])
|
||||
|
||||
@pytest.mark.level(2)
|
||||
def test_get_entities_indexed_single(self, connect, collection, get_simple_index, get_pos):
|
||||
'''
|
||||
target: test.get_entity_by_id
|
||||
|
|
|
@ -826,8 +826,11 @@ class TestInsertInvalid(object):
|
|||
'''
|
||||
entity_id = get_entity_id
|
||||
ids = [entity_id for _ in range(nb)]
|
||||
with pytest.raises(Exception):
|
||||
if isinstance(entity_id, int):
|
||||
connect.insert(id_collection, entities, ids)
|
||||
else:
|
||||
with pytest.raises(Exception):
|
||||
connect.insert(id_collection, entities, ids)
|
||||
|
||||
def test_insert_with_invalid_collection_name(self, connect, get_collection_name):
|
||||
collection_name = get_collection_name
|
||||
|
|
|
@ -200,16 +200,18 @@ class TestListIdInSegmentBase:
|
|||
assert len(vector_ids) == 1
|
||||
assert vector_ids[0] == ids[1]
|
||||
|
||||
@pytest.mark.level(2)
|
||||
def test_list_id_in_segment_with_index_ip(self, connect, collection, get_simple_index):
|
||||
'''
|
||||
target: get vector ids when there is index
|
||||
method: call list_id_in_segment and check if the segment contains vectors
|
||||
expected: status ok
|
||||
expected: ids returned in ids inserted
|
||||
'''
|
||||
get_simple_index["metric_type"] = "IP"
|
||||
ids, seg_id = get_segment_id(connect, collection, nb=nb, index_params=get_simple_index)
|
||||
vector_ids = connect.list_id_in_segment(collection, seg_id)
|
||||
# TODO:
|
||||
assert vector_ids == ids
|
||||
|
||||
|
||||
class TestListIdInSegmentBinary:
|
||||
|
|
|
@ -214,24 +214,21 @@ class TestSearchBase:
|
|||
assert res[0]._distances[0] < epsilon
|
||||
assert check_id_result(res[0], ids[0])
|
||||
|
||||
@pytest.mark.level(2)
|
||||
@pytest.mark.skip
|
||||
def test_search_after_index_different_metric_type(self, connect, collection, get_simple_index):
|
||||
'''
|
||||
target: test search with different metric_type
|
||||
method: build index with L2, and search using IP
|
||||
expected: exception raised
|
||||
expected: search ok
|
||||
'''
|
||||
search_metric_type = "IP"
|
||||
index_type = get_simple_index["index_type"]
|
||||
if index_type != "FLAT":
|
||||
pytest.skip("skip flat")
|
||||
entities, ids = init_data(connect, collection)
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
search_param = get_search_param(index_type)
|
||||
query, vecs = gen_query_vectors(field_name, entities, top_k, nq, metric_type=search_metric_type, search_params=search_param)
|
||||
with pytest.raises(Exception) as e:
|
||||
res = connect.search(collection, query)
|
||||
res = connect.search(collection, query)
|
||||
assert len(res) == nq
|
||||
assert len(res[0]) == top_k
|
||||
|
||||
@pytest.mark.level(2)
|
||||
def test_search_index_partition(self, connect, collection, get_simple_index, get_top_k, get_nq):
|
||||
|
|
|
@ -323,17 +323,17 @@ class TestCompactBase:
|
|||
method: create 50 collections, add entities into them and compact in turn
|
||||
expected: status ok
|
||||
'''
|
||||
nq = 100
|
||||
num_collections = 50
|
||||
entities = gen_entities(nq)
|
||||
nb = 100
|
||||
num_collections = 20
|
||||
entities = gen_entities(nb)
|
||||
collection_list = []
|
||||
for i in range(num_collections):
|
||||
collection_name = gen_unique_str("test_compact_multi_collection_%d" % i)
|
||||
collection_list.append(collection_name)
|
||||
connect.create_collection(collection_name, default_fields)
|
||||
time.sleep(6)
|
||||
for i in range(num_collections):
|
||||
ids = connect.insert(collection_list[i], entities)
|
||||
connect.delete_entity_by_id(collection_list[i], ids[:nb//2])
|
||||
status = connect.compact(collection_list[i])
|
||||
assert status.OK()
|
||||
|
||||
|
|
|
@ -156,18 +156,19 @@ class TestIndexBase:
|
|||
target: test create index interface when collection name not existed
|
||||
method: create collection and add entities in it, create index
|
||||
, make sure the collection name not in index
|
||||
expected: return code not equals to 0, create index failed
|
||||
expected: create index failed
|
||||
'''
|
||||
collection_name = gen_unique_str(collection_id)
|
||||
with pytest.raises(Exception) as e:
|
||||
connect.create_index(collection_name, field_name, default_index)
|
||||
|
||||
@pytest.mark.level(2)
|
||||
@pytest.mark.timeout(BUILD_TIMEOUT)
|
||||
def test_create_index_no_vectors_insert(self, connect, collection, get_simple_index):
|
||||
def test_create_index_insert_flush(self, connect, collection, get_simple_index):
|
||||
'''
|
||||
target: test create index interface when there is no vectors in collection, and does not affect the subsequent process
|
||||
method: create collection and add no vectors in it, and then create index, add entities in it
|
||||
expected: return code equals to 0
|
||||
target: test create index
|
||||
method: create collection and create index, add entities in it
|
||||
expected: create index ok, and count correct
|
||||
'''
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
ids = connect.insert(collection, entities)
|
||||
|
|
|
@ -568,26 +568,19 @@ def gen_invalid_metric_types():
|
|||
|
||||
# TODO:
|
||||
def gen_invalid_ints():
|
||||
top_ks = [
|
||||
int_values = [
|
||||
# 1.0,
|
||||
None,
|
||||
"stringg",
|
||||
[1, 2, 3],
|
||||
(1, 2),
|
||||
{"a": 1},
|
||||
" ",
|
||||
"",
|
||||
-1,
|
||||
"String",
|
||||
"12-s",
|
||||
"BB。A",
|
||||
" siede ",
|
||||
"(mn)",
|
||||
"pip+",
|
||||
"=c",
|
||||
"中文",
|
||||
"a".join("a" for i in range(256))
|
||||
]
|
||||
return top_ks
|
||||
return int_values
|
||||
|
||||
|
||||
def gen_invalid_params():
|
||||
|
|
Loading…
Reference in New Issue