|
@@ 1205-1221 (lines=17) @@
|
| 1202 |
|
with pytest.raises(Exception) as e: |
| 1203 |
|
status, result = connect.search(collection, top_k, query_vecs) |
| 1204 |
|
|
| 1205 |
|
@pytest.mark.level(2) |
| 1206 |
|
def test_search_with_invalid_top_k_ip(self, connect, ip_collection, get_top_k): |
| 1207 |
|
''' |
| 1208 |
|
target: test search fuction, with the wrong top_k |
| 1209 |
|
method: search with top_k |
| 1210 |
|
expected: raise an error, and the connection is normal |
| 1211 |
|
''' |
| 1212 |
|
top_k = get_top_k |
| 1213 |
|
logging.getLogger().info(top_k) |
| 1214 |
|
nprobe = 1 |
| 1215 |
|
query_vecs = gen_vectors(1, dim) |
| 1216 |
|
if isinstance(top_k, int): |
| 1217 |
|
status, result = connect.search(ip_collection, top_k, query_vecs) |
| 1218 |
|
assert not status.OK() |
| 1219 |
|
else: |
| 1220 |
|
with pytest.raises(Exception) as e: |
| 1221 |
|
status, result = connect.search(ip_collection, top_k, query_vecs) |
| 1222 |
|
|
| 1223 |
|
""" |
| 1224 |
|
Test search collection with invalid nprobe |
|
@@ 1187-1203 (lines=17) @@
|
| 1184 |
|
def get_top_k(self, request): |
| 1185 |
|
yield request.param |
| 1186 |
|
|
| 1187 |
|
@pytest.mark.level(1) |
| 1188 |
|
def test_search_with_invalid_top_k(self, connect, collection, get_top_k): |
| 1189 |
|
''' |
| 1190 |
|
target: test search fuction, with the wrong top_k |
| 1191 |
|
method: search with top_k |
| 1192 |
|
expected: raise an error, and the connection is normal |
| 1193 |
|
''' |
| 1194 |
|
top_k = get_top_k |
| 1195 |
|
logging.getLogger().info(top_k) |
| 1196 |
|
nprobe = 1 |
| 1197 |
|
query_vecs = gen_vectors(1, dim) |
| 1198 |
|
if isinstance(top_k, int): |
| 1199 |
|
status, result = connect.search(collection, top_k, query_vecs) |
| 1200 |
|
assert not status.OK() |
| 1201 |
|
else: |
| 1202 |
|
with pytest.raises(Exception) as e: |
| 1203 |
|
status, result = connect.search(collection, top_k, query_vecs) |
| 1204 |
|
|
| 1205 |
|
@pytest.mark.level(2) |
| 1206 |
|
def test_search_with_invalid_top_k_ip(self, connect, ip_collection, get_top_k): |