mirror of https://github.com/milvus-io/milvus.git
Update describe_index in python tests (#5328)
Signed-off-by: sunby <bingyi.sun@zilliz.com>pull/5280/head
parent
f6ab3c81df
commit
ac0b878531
|
@ -395,10 +395,12 @@ class TestGetCollectionStats:
|
|||
for i in range(collection_num):
|
||||
stats = connect.get_collection_stats(collection_list[i])
|
||||
assert stats[row_count] == default_nb
|
||||
index = connect.describe_index(collection_list[i], default_float_vec_field_name)
|
||||
index = connect.describe_index(collection_list[i], "")
|
||||
if i % 2:
|
||||
create_target_index(index_1, default_float_vec_field_name)
|
||||
assert index == index_1
|
||||
else:
|
||||
create_target_index(index_2, default_float_vec_field_name)
|
||||
assert index == index_2
|
||||
# break
|
||||
connect.drop_collection(collection_list[i])
|
||||
|
|
|
@ -69,7 +69,7 @@ class TestDescribeCollection:
|
|||
def test_describe_collection_after_index_created(self, connect, collection, get_simple_index):
|
||||
connect.create_index(collection, default_float_vec_field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, default_float_vec_field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
assert index["index_type"] == get_simple_index["index_type"]
|
||||
assert index["metric_type"] == get_simple_index["metric_type"]
|
||||
assert index["params"] == get_simple_index["params"]
|
||||
|
|
|
@ -67,7 +67,8 @@ class TestLoadCollection:
|
|||
connect.create_index(binary_collection, default_binary_vec_field_name, get_binary_index)
|
||||
else:
|
||||
connect.create_index(binary_collection, default_binary_vec_field_name, get_binary_index)
|
||||
index = connect.describe_index(binary_collection, default_binary_vec_field_name)
|
||||
index = connect.describe_index(binary_collection, "")
|
||||
create_target_index(get_binary_index, default_binary_vec_field_name)
|
||||
assert index == get_binary_index
|
||||
connect.load_collection(binary_collection)
|
||||
connect.release_collection(binary_collection)
|
||||
|
@ -666,4 +667,4 @@ class TestLoadPartitionInvalid(object):
|
|||
def test_release_partition_with_invalid_partition_name(self, connect, collection, get_partition_name):
|
||||
partition_name = get_partition_name
|
||||
with pytest.raises(Exception) as e:
|
||||
connect.load_partitions(collection, [partition_name])
|
||||
connect.load_partitions(collection, [partition_name])
|
||||
|
|
|
@ -131,7 +131,8 @@ class TestInsertBase:
|
|||
connect.flush([collection])
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
@pytest.mark.timeout(ADD_TIMEOUT)
|
||||
|
@ -146,7 +147,8 @@ class TestInsertBase:
|
|||
ids = connect.insert(collection, default_entities)
|
||||
assert len(ids) == default_nb
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
@pytest.mark.timeout(ADD_TIMEOUT)
|
||||
|
@ -605,7 +607,8 @@ class TestInsertBinary:
|
|||
ids = connect.insert(binary_collection, default_binary_entities)
|
||||
assert len(ids) == default_nb
|
||||
connect.flush([binary_collection])
|
||||
index = connect.describe_index(binary_collection, binary_field_name)
|
||||
index = connect.describe_index(binary_collection, "")
|
||||
create_target_index(get_binary_index, binary_field_name)
|
||||
assert index == get_binary_index
|
||||
|
||||
@pytest.mark.timeout(ADD_TIMEOUT)
|
||||
|
@ -619,7 +622,8 @@ class TestInsertBinary:
|
|||
assert len(ids) == default_nb
|
||||
connect.flush([binary_collection])
|
||||
connect.create_index(binary_collection, binary_field_name, get_binary_index)
|
||||
index = connect.describe_index(binary_collection, binary_field_name)
|
||||
index = connect.describe_index(binary_collection, "")
|
||||
create_target_index(get_binary_index, binary_field_name)
|
||||
assert index == get_binary_index
|
||||
|
||||
@pytest.mark.tags(CaseLabel.tags_smoke)
|
||||
|
@ -824,7 +828,8 @@ class TestInsertMultiCollections:
|
|||
ids = connect.insert(collection_name, default_entity)
|
||||
assert len(ids) == 1
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
connect.drop_collection(collection_name)
|
||||
|
||||
|
@ -842,7 +847,8 @@ class TestInsertMultiCollections:
|
|||
connect.flush([collection])
|
||||
connect.create_index(collection_name, field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection_name, field_name)
|
||||
index = connect.describe_index(collection_name, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
stats = connect.get_collection_stats(collection)
|
||||
assert stats[row_count] == 1
|
||||
|
|
|
@ -10,7 +10,7 @@ allure-pytest==2.7.0
|
|||
pytest-print==0.2.1
|
||||
pytest-level==0.1.1
|
||||
pytest-xdist==2.2.1
|
||||
pymilvus-distributed==0.0.63
|
||||
pymilvus-distributed==0.0.65
|
||||
pytest-rerunfailures==9.1.1
|
||||
git+https://github.com/Projectplace/pytest-tags
|
||||
ndg-httpsclient
|
||||
|
|
|
@ -58,7 +58,8 @@ class TestIndexBase:
|
|||
ids = connect.insert(collection, default_entities)
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
@pytest.mark.tags(CaseLabel.tags_smoke)
|
||||
|
@ -94,7 +95,8 @@ class TestIndexBase:
|
|||
'''
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
@pytest.mark.timeout(BUILD_TIMEOUT)
|
||||
|
@ -108,7 +110,8 @@ class TestIndexBase:
|
|||
ids = connect.insert(collection, default_entities, partition_tag=default_tag)
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
@pytest.mark.tags(CaseLabel.tags_smoke)
|
||||
|
@ -124,7 +127,8 @@ class TestIndexBase:
|
|||
connect.flush([collection])
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
def test_create_index_without_connect(self, dis_connect, collection):
|
||||
|
@ -147,7 +151,7 @@ class TestIndexBase:
|
|||
ids = connect.insert(collection, default_entities)
|
||||
connect.flush([collection])
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
logging.getLogger().info(connect.describe_index(collection, field_name))
|
||||
logging.getLogger().info(connect.describe_index(collection, ""))
|
||||
nq = get_nq
|
||||
index_type = get_simple_index["index_type"]
|
||||
search_param = get_search_param(index_type)
|
||||
|
@ -169,7 +173,8 @@ class TestIndexBase:
|
|||
def build(connect):
|
||||
connect.create_index(collection, field_name, default_index)
|
||||
if default_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(default_index, field_name)
|
||||
assert index == default_index
|
||||
|
||||
threads_num = 8
|
||||
|
@ -209,7 +214,8 @@ class TestIndexBase:
|
|||
stats = connect.get_collection_stats(collection)
|
||||
assert stats["row_count"] == default_nb
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
@pytest.mark.level(2)
|
||||
|
@ -223,7 +229,8 @@ class TestIndexBase:
|
|||
connect.create_index(collection, field_name, get_simple_index)
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
@pytest.mark.level(2)
|
||||
|
@ -241,7 +248,7 @@ class TestIndexBase:
|
|||
connect.create_index(collection, field_name, index)
|
||||
connect.release_collection(collection)
|
||||
connect.load_collection(collection)
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
# assert index == indexs[-1]
|
||||
assert not index # FLAT is the last index_type, drop all indexes in server
|
||||
|
||||
|
@ -260,7 +267,8 @@ class TestIndexBase:
|
|||
connect.create_index(collection, field_name, index)
|
||||
connect.release_collection(collection)
|
||||
connect.load_collection(collection)
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(indexs[-1], field_name)
|
||||
assert index == indexs[-1]
|
||||
# assert not index # FLAT is the last index_type, drop all indexes in server
|
||||
|
||||
|
@ -276,7 +284,8 @@ class TestIndexBase:
|
|||
get_simple_index["metric_type"] = "IP"
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
@pytest.mark.tags(CaseLabel.tags_smoke)
|
||||
|
@ -290,7 +299,8 @@ class TestIndexBase:
|
|||
get_simple_index["metric_type"] = "IP"
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
@pytest.mark.timeout(BUILD_TIMEOUT)
|
||||
|
@ -305,7 +315,8 @@ class TestIndexBase:
|
|||
get_simple_index["metric_type"] = "IP"
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
@pytest.mark.tags(CaseLabel.tags_smoke)
|
||||
|
@ -322,7 +333,8 @@ class TestIndexBase:
|
|||
get_simple_index["metric_type"] = "IP"
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
if get_simple_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(get_simple_index, field_name)
|
||||
assert index == get_simple_index
|
||||
|
||||
@pytest.mark.tags(CaseLabel.tags_smoke)
|
||||
|
@ -339,7 +351,7 @@ class TestIndexBase:
|
|||
get_simple_index["metric_type"] = metric_type
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
connect.load_collection(collection)
|
||||
logging.getLogger().info(connect.describe_index(collection, field_name))
|
||||
logging.getLogger().info(connect.describe_index(collection, ""))
|
||||
nq = get_nq
|
||||
index_type = get_simple_index["index_type"]
|
||||
search_param = get_search_param(index_type)
|
||||
|
@ -361,7 +373,8 @@ class TestIndexBase:
|
|||
default_index["metric_type"] = "IP"
|
||||
connect.create_index(collection, field_name, default_index)
|
||||
if default_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(default_index, field_name)
|
||||
assert index == default_index
|
||||
|
||||
threads_num = 8
|
||||
|
@ -402,7 +415,8 @@ class TestIndexBase:
|
|||
stats = connect.get_collection_stats(collection)
|
||||
assert stats["row_count"] == default_nb
|
||||
if default_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(default_index, field_name)
|
||||
assert index == default_index
|
||||
|
||||
@pytest.mark.level(2)
|
||||
|
@ -417,7 +431,8 @@ class TestIndexBase:
|
|||
connect.create_index(collection, field_name, default_index)
|
||||
connect.create_index(collection, field_name, default_index)
|
||||
if default_index["index_type"] != "FLAT":
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(default_index, field_name)
|
||||
assert index == default_index
|
||||
|
||||
@pytest.mark.level(2)
|
||||
|
@ -439,7 +454,7 @@ class TestIndexBase:
|
|||
connect.create_index(collection, field_name, index)
|
||||
connect.release_collection(collection)
|
||||
connect.load_collection(collection)
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
# assert index == indexs[-1]
|
||||
assert not index
|
||||
|
||||
|
@ -458,7 +473,7 @@ class TestIndexBase:
|
|||
# ids = connect.insert(collection, entities)
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
connect.drop_index(collection, field_name)
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
assert not index
|
||||
|
||||
@pytest.mark.level(2)
|
||||
|
@ -471,7 +486,7 @@ class TestIndexBase:
|
|||
connect.create_index(collection, field_name, get_simple_index)
|
||||
connect.drop_index(collection, field_name)
|
||||
connect.drop_index(collection, field_name)
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
assert not index
|
||||
|
||||
@pytest.mark.level(2)
|
||||
|
@ -527,7 +542,7 @@ class TestIndexBase:
|
|||
get_simple_index["metric_type"] = "IP"
|
||||
connect.create_index(collection, field_name, get_simple_index)
|
||||
connect.drop_index(collection, field_name)
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
assert not index
|
||||
|
||||
@pytest.mark.level(2)
|
||||
|
@ -541,7 +556,7 @@ class TestIndexBase:
|
|||
connect.create_index(collection, field_name, get_simple_index)
|
||||
connect.drop_index(collection, field_name)
|
||||
connect.drop_index(collection, field_name)
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
assert not index
|
||||
|
||||
@pytest.mark.level(2)
|
||||
|
@ -581,7 +596,8 @@ class TestIndexBase:
|
|||
PQ_index = {"index_type": "IVF_PQ", "params": {"nlist": 128, "m": 16}, "metric_type": "L2"}
|
||||
ids = connect.insert(collection, default_entities)
|
||||
connect.create_index(collection, field_name, PQ_index)
|
||||
index = connect.describe_index(collection, field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(PQ_index, field_name)
|
||||
assert index == PQ_index
|
||||
|
||||
|
||||
|
@ -640,7 +656,8 @@ class TestIndexBinary:
|
|||
'''
|
||||
ids = connect.insert(binary_collection, default_binary_entities)
|
||||
connect.create_index(binary_collection, binary_field_name, get_jaccard_index)
|
||||
binary_index = connect.describe_index(binary_collection, binary_field_name)
|
||||
binary_index = connect.describe_index(binary_collection, "")
|
||||
create_target_index(get_jaccard_index, binary_field_name)
|
||||
assert binary_index == get_jaccard_index
|
||||
|
||||
@pytest.mark.tags(CaseLabel.tags_smoke)
|
||||
|
@ -654,7 +671,8 @@ class TestIndexBinary:
|
|||
connect.create_partition(binary_collection, default_tag)
|
||||
ids = connect.insert(binary_collection, default_binary_entities, partition_tag=default_tag)
|
||||
connect.create_index(binary_collection, binary_field_name, get_jaccard_index)
|
||||
binary_index = connect.describe_index(binary_collection, binary_field_name)
|
||||
binary_index = connect.describe_index(binary_collection, "")
|
||||
create_target_index(get_jaccard_index, binary_field_name)
|
||||
assert binary_index == get_jaccard_index
|
||||
|
||||
@pytest.mark.tags(CaseLabel.tags_smoke)
|
||||
|
@ -752,7 +770,7 @@ class TestIndexBinary:
|
|||
stats = connect.get_collection_stats(binary_collection)
|
||||
logging.getLogger().info(stats)
|
||||
connect.drop_index(binary_collection, binary_field_name)
|
||||
binary_index = connect.describe_index(binary_collection, binary_field_name)
|
||||
binary_index = connect.describe_index(binary_collection, "")
|
||||
assert not binary_index
|
||||
|
||||
@pytest.mark.tags(CaseLabel.tags_smoke)
|
||||
|
@ -767,7 +785,7 @@ class TestIndexBinary:
|
|||
connect.flush([binary_collection])
|
||||
connect.create_index(binary_collection, binary_field_name, get_jaccard_index)
|
||||
connect.drop_index(binary_collection, binary_field_name)
|
||||
binary_index = connect.describe_index(binary_collection, binary_field_name)
|
||||
binary_index = connect.describe_index(binary_collection, "")
|
||||
assert not binary_index
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ class TestMixBase:
|
|||
assert len(ids) == nb
|
||||
connect.flush([collection])
|
||||
connect.create_index(collection, default_float_vec_field_name, default_index)
|
||||
index = connect.describe_index(collection, default_float_vec_field_name)
|
||||
index = connect.describe_index(collection, "")
|
||||
create_target_index(default_index, default_float_vec_field_name)
|
||||
assert index == default_index
|
||||
query, vecs = gen_query_vectors(default_float_vec_field_name, entities, default_top_k, nq)
|
||||
connect.load_collection(collection)
|
||||
|
@ -193,4 +194,4 @@ def check_id_result(result, id):
|
|||
if len(result) >= limit_in:
|
||||
return id in ids[:limit_in]
|
||||
else:
|
||||
return id in ids
|
||||
return id in ids
|
||||
|
|
|
@ -68,6 +68,8 @@ default_index_params = [
|
|||
{"nlist": 128}
|
||||
]
|
||||
|
||||
def create_target_index(index,field_name):
|
||||
index["field_name"]=field_name
|
||||
|
||||
def index_cpu_not_support():
|
||||
return ["IVF_SQ8_HYBRID"]
|
||||
|
@ -1018,3 +1020,4 @@ class MyThread(threading.Thread):
|
|||
|
||||
class CaseLabel:
|
||||
tags_smoke = "smoke"
|
||||
|
||||
|
|
Loading…
Reference in New Issue