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

[skip ci] disable ubuntu && update case (#3244)

* [skip ci] disable ubuntu && update case
Signed-off-by: Nzw <zw@milvus.io>

* some cases set level-1 from level-2
Signed-off-by: Nzw <zw@milvus.io>

* add get collection info case: after index created
Signed-off-by: Nzw <zw@milvus.io>

* add -1 in invalid ints
Signed-off-by: Nzw <zw@milvus.io>

* remove douban pip during install python-lib
Signed-off-by: Nzw <zw@milvus.io>
Co-authored-by: Nzw <zw@milvus.io>
上级 4beb0549
...@@ -25,7 +25,8 @@ timeout(time: 120, unit: 'MINUTES') { ...@@ -25,7 +25,8 @@ timeout(time: 120, unit: 'MINUTES') {
} }
dir ("tests/milvus_python_test") { 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()) { 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" 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 { } else {
......
...@@ -301,6 +301,7 @@ class TestStatsBase: ...@@ -301,6 +301,7 @@ class TestStatsBase:
assert stats["partitions"][0]["segments"][0]["row_count"] == nb assert stats["partitions"][0]["segments"][0]["row_count"] == nb
connect.drop_collection(collection_list[i]) connect.drop_collection(collection_list[i])
@pytest.mark.level(2)
def test_collection_count_multi_collections_indexed(self, connect): def test_collection_count_multi_collections_indexed(self, connect):
''' '''
target: test collection rows_count is correct or not with multiple collections of L2 target: test collection rows_count is correct or not with multiple collections of L2
......
...@@ -10,6 +10,7 @@ from utils import * ...@@ -10,6 +10,7 @@ from utils import *
collection_id = "info" collection_id = "info"
default_fields = gen_default_fields() default_fields = gen_default_fields()
segment_row_count = 5000 segment_row_count = 5000
field_name = "float_vector"
class TestInfoBase: class TestInfoBase:
...@@ -35,6 +36,17 @@ class TestInfoBase: ...@@ -35,6 +36,17 @@ class TestInfoBase:
def get_segment_row_count(self, request): def get_segment_row_count(self, request):
yield request.param 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 The following cases are used to test `get_collection_info` function, no data in collection
...@@ -76,6 +88,14 @@ class TestInfoBase: ...@@ -76,6 +88,14 @@ class TestInfoBase:
connect.create_collection(collection_name, fields) connect.create_collection(collection_name, fields)
# assert segment size # 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) @pytest.mark.level(2)
def test_get_collection_info_without_connection(self, collection, dis_connect): def test_get_collection_info_without_connection(self, collection, dis_connect):
...@@ -98,6 +118,7 @@ class TestInfoBase: ...@@ -98,6 +118,7 @@ class TestInfoBase:
with pytest.raises(Exception) as e: with pytest.raises(Exception) as e:
res = connect.get_collection_info(connect, collection_name) res = connect.get_collection_info(connect, collection_name)
@pytest.mark.level(2)
def test_get_collection_info_multithread(self, connect): def test_get_collection_info_multithread(self, connect):
''' '''
target: test create collection with multithread target: test create collection with multithread
......
...@@ -34,7 +34,7 @@ class TestListCollections: ...@@ -34,7 +34,7 @@ class TestListCollections:
method: create collection, assert the value returned by list_collections method method: create collection, assert the value returned by list_collections method
expected: True expected: True
''' '''
collection_num = 100 collection_num = 50
for i in range(collection_num): for i in range(collection_num):
collection_name = gen_unique_str(collection_id) collection_name = gen_unique_str(collection_id)
connect.create_collection(collection_name, default_fields) connect.create_collection(collection_name, default_fields)
...@@ -60,6 +60,7 @@ class TestListCollections: ...@@ -60,6 +60,7 @@ class TestListCollections:
collection_name = gen_unique_str(collection_id) collection_name = gen_unique_str(collection_id)
assert collection_name not in connect.list_collections() assert collection_name not in connect.list_collections()
@pytest.mark.level(2)
def test_list_collections_no_collection(self, connect): def test_list_collections_no_collection(self, connect):
''' '''
target: test show collections is correct or not, if no collection in db target: test show collections is correct or not, if no collection in db
......
...@@ -42,6 +42,21 @@ class TestLoadCollection: ...@@ -42,6 +42,21 @@ class TestLoadCollection:
connect.create_index(collection, field_name, get_simple_index) connect.create_index(collection, field_name, get_simple_index)
connect.load_collection(collection) 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): def load_empty_collection(self, connect, collection):
''' '''
target: test load collection target: test load collection
...@@ -50,7 +65,7 @@ class TestLoadCollection: ...@@ -50,7 +65,7 @@ class TestLoadCollection:
''' '''
connect.load_collection(collection) connect.load_collection(collection)
@pytest.mark.level(1) @pytest.mark.level(2)
def test_load_collection_dis_connect(self, dis_connect, collection): def test_load_collection_dis_connect(self, dis_connect, collection):
''' '''
target: test load collection, without connection target: test load collection, without connection
...@@ -66,6 +81,15 @@ class TestLoadCollection: ...@@ -66,6 +81,15 @@ class TestLoadCollection:
with pytest.raises(Exception) as e: with pytest.raises(Exception) as e:
connect.load_collection(collection_name) 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): class TestLoadCollectionInvalid(object):
""" """
......
...@@ -290,6 +290,7 @@ class TestDeleteBase: ...@@ -290,6 +290,7 @@ class TestDeleteBase:
res_get = connect.get_entity_by_id(collection, delete_ids) res_get = connect.get_entity_by_id(collection, delete_ids)
assert res_get[0] is None assert res_get[0] is None
@pytest.mark.level(2)
def test_index_insert_single_delete_get(self, connect, id_collection, get_simple_index): def test_index_insert_single_delete_get(self, connect, id_collection, get_simple_index):
''' '''
method: create index, insert entities, and delete method: create index, insert entities, and delete
......
...@@ -261,6 +261,7 @@ class TestGetBase: ...@@ -261,6 +261,7 @@ class TestGetBase:
for i in range(get_pos, get_pos*2): 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]) 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): def test_get_entities_indexed_tag(self, connect, collection, get_simple_index, get_pos):
''' '''
target: test.get_entity_by_id target: test.get_entity_by_id
...@@ -427,6 +428,7 @@ class TestGetBase: ...@@ -427,6 +428,7 @@ class TestGetBase:
for i in range(get_pos): for i in range(get_pos):
assert_equal_vector(res[i].get(default_float_vec_field_name), entities[-1]["values"][i]) 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): def test_get_entities_indexed_single(self, connect, collection, get_simple_index, get_pos):
''' '''
target: test.get_entity_by_id target: test.get_entity_by_id
......
...@@ -826,6 +826,9 @@ class TestInsertInvalid(object): ...@@ -826,6 +826,9 @@ class TestInsertInvalid(object):
''' '''
entity_id = get_entity_id entity_id = get_entity_id
ids = [entity_id for _ in range(nb)] ids = [entity_id for _ in range(nb)]
if isinstance(entity_id, int):
connect.insert(id_collection, entities, ids)
else:
with pytest.raises(Exception): with pytest.raises(Exception):
connect.insert(id_collection, entities, ids) connect.insert(id_collection, entities, ids)
......
...@@ -200,16 +200,18 @@ class TestListIdInSegmentBase: ...@@ -200,16 +200,18 @@ class TestListIdInSegmentBase:
assert len(vector_ids) == 1 assert len(vector_ids) == 1
assert vector_ids[0] == 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): def test_list_id_in_segment_with_index_ip(self, connect, collection, get_simple_index):
''' '''
target: get vector ids when there is index target: get vector ids when there is index
method: call list_id_in_segment and check if the segment contains vectors 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" get_simple_index["metric_type"] = "IP"
ids, seg_id = get_segment_id(connect, collection, nb=nb, index_params=get_simple_index) 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) vector_ids = connect.list_id_in_segment(collection, seg_id)
# TODO: # TODO:
assert vector_ids == ids
class TestListIdInSegmentBinary: class TestListIdInSegmentBinary:
......
...@@ -214,24 +214,21 @@ class TestSearchBase: ...@@ -214,24 +214,21 @@ class TestSearchBase:
assert res[0]._distances[0] < epsilon assert res[0]._distances[0] < epsilon
assert check_id_result(res[0], ids[0]) 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): def test_search_after_index_different_metric_type(self, connect, collection, get_simple_index):
''' '''
target: test search with different metric_type target: test search with different metric_type
method: build index with L2, and search using IP method: build index with L2, and search using IP
expected: exception raised expected: search ok
''' '''
search_metric_type = "IP" search_metric_type = "IP"
index_type = get_simple_index["index_type"] index_type = get_simple_index["index_type"]
if index_type != "FLAT":
pytest.skip("skip flat")
entities, ids = init_data(connect, collection) entities, ids = init_data(connect, collection)
connect.create_index(collection, field_name, get_simple_index) connect.create_index(collection, field_name, get_simple_index)
search_param = get_search_param(index_type) 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) 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) @pytest.mark.level(2)
def test_search_index_partition(self, connect, collection, get_simple_index, get_top_k, get_nq): def test_search_index_partition(self, connect, collection, get_simple_index, get_top_k, get_nq):
......
...@@ -323,17 +323,17 @@ class TestCompactBase: ...@@ -323,17 +323,17 @@ class TestCompactBase:
method: create 50 collections, add entities into them and compact in turn method: create 50 collections, add entities into them and compact in turn
expected: status ok expected: status ok
''' '''
nq = 100 nb = 100
num_collections = 50 num_collections = 20
entities = gen_entities(nq) entities = gen_entities(nb)
collection_list = [] collection_list = []
for i in range(num_collections): for i in range(num_collections):
collection_name = gen_unique_str("test_compact_multi_collection_%d" % i) collection_name = gen_unique_str("test_compact_multi_collection_%d" % i)
collection_list.append(collection_name) collection_list.append(collection_name)
connect.create_collection(collection_name, default_fields) connect.create_collection(collection_name, default_fields)
time.sleep(6)
for i in range(num_collections): for i in range(num_collections):
ids = connect.insert(collection_list[i], entities) ids = connect.insert(collection_list[i], entities)
connect.delete_entity_by_id(collection_list[i], ids[:nb//2])
status = connect.compact(collection_list[i]) status = connect.compact(collection_list[i])
assert status.OK() assert status.OK()
......
...@@ -156,18 +156,19 @@ class TestIndexBase: ...@@ -156,18 +156,19 @@ class TestIndexBase:
target: test create index interface when collection name not existed target: test create index interface when collection name not existed
method: create collection and add entities in it, create index method: create collection and add entities in it, create index
, make sure the collection name not in 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) collection_name = gen_unique_str(collection_id)
with pytest.raises(Exception) as e: with pytest.raises(Exception) as e:
connect.create_index(collection_name, field_name, default_index) connect.create_index(collection_name, field_name, default_index)
@pytest.mark.level(2)
@pytest.mark.timeout(BUILD_TIMEOUT) @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 target: test create index
method: create collection and add no vectors in it, and then create index, add entities in it method: create collection and create index, add entities in it
expected: return code equals to 0 expected: create index ok, and count correct
''' '''
connect.create_index(collection, field_name, get_simple_index) connect.create_index(collection, field_name, get_simple_index)
ids = connect.insert(collection, entities) ids = connect.insert(collection, entities)
......
...@@ -568,26 +568,19 @@ def gen_invalid_metric_types(): ...@@ -568,26 +568,19 @@ def gen_invalid_metric_types():
# TODO: # TODO:
def gen_invalid_ints(): def gen_invalid_ints():
top_ks = [ int_values = [
# 1.0, # 1.0,
None, None,
"stringg",
[1, 2, 3], [1, 2, 3],
(1, 2),
{"a": 1},
" ", " ",
"", "",
-1,
"String", "String",
"12-s",
"BB。A",
" siede ",
"(mn)",
"pip+",
"=c", "=c",
"中文", "中文",
"a".join("a" for i in range(256)) "a".join("a" for i in range(256))
] ]
return top_ks return int_values
def gen_invalid_params(): def gen_invalid_params():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册