|
@@ 1255-1272 (lines=18) @@
|
| 1252 |
|
# with pytest.raises(Exception) as e: |
| 1253 |
|
# status, result = connect.search(collection, top_k, query_vecs, params=search_param) |
| 1254 |
|
|
| 1255 |
|
@pytest.mark.level(2) |
| 1256 |
|
def test_search_with_invalid_nprobe_ip(self, connect, ip_collection, get_nprobes): |
| 1257 |
|
''' |
| 1258 |
|
target: test search fuction, with the wrong top_k |
| 1259 |
|
method: search with top_k |
| 1260 |
|
expected: raise an error, and the connection is normal |
| 1261 |
|
''' |
| 1262 |
|
index_type = IndexType.IVF_SQ8 |
| 1263 |
|
index_param = {"nlist": 16384} |
| 1264 |
|
connect.create_index(ip_collection, index_type, index_param) |
| 1265 |
|
nprobe = get_nprobes |
| 1266 |
|
search_param = {"nprobe": nprobe} |
| 1267 |
|
logging.getLogger().info(nprobe) |
| 1268 |
|
query_vecs = gen_vectors(1, dim) |
| 1269 |
|
|
| 1270 |
|
# if isinstance(nprobe, int): |
| 1271 |
|
status, result = connect.search(ip_collection, top_k, query_vecs, params=search_param) |
| 1272 |
|
assert not status.OK() |
| 1273 |
|
# else: |
| 1274 |
|
# with pytest.raises(Exception) as e: |
| 1275 |
|
# status, result = connect.search(ip_collection, top_k, query_vecs, params=search_param) |
|
@@ 1234-1250 (lines=17) @@
|
| 1231 |
|
def get_nprobes(self, request): |
| 1232 |
|
yield request.param |
| 1233 |
|
|
| 1234 |
|
@pytest.mark.level(1) |
| 1235 |
|
def test_search_with_invalid_nprobe(self, connect, collection, get_nprobes): |
| 1236 |
|
''' |
| 1237 |
|
target: test search fuction, with the wrong nprobe |
| 1238 |
|
method: search with nprobe |
| 1239 |
|
expected: raise an error, and the connection is normal |
| 1240 |
|
''' |
| 1241 |
|
index_type = IndexType.IVF_SQ8 |
| 1242 |
|
index_param = {"nlist": 16384} |
| 1243 |
|
connect.create_index(collection, index_type, index_param) |
| 1244 |
|
nprobe = get_nprobes |
| 1245 |
|
search_param = {"nprobe": nprobe} |
| 1246 |
|
logging.getLogger().info(nprobe) |
| 1247 |
|
query_vecs = gen_vectors(1, dim) |
| 1248 |
|
# if isinstance(nprobe, int): |
| 1249 |
|
status, result = connect.search(collection, top_k, query_vecs, params=search_param) |
| 1250 |
|
assert not status.OK() |
| 1251 |
|
# else: |
| 1252 |
|
# with pytest.raises(Exception) as e: |
| 1253 |
|
# status, result = connect.search(collection, top_k, query_vecs, params=search_param) |