|
@@ 313-329 (lines=17) @@
|
| 310 |
|
for i in range(nb): |
| 311 |
|
assert vector_ids[i] == ids[i] |
| 312 |
|
|
| 313 |
|
def test_list_id_in_segment_without_index_B(self, connect, jac_collection): |
| 314 |
|
''' |
| 315 |
|
target: get vector ids when there is no index but with partition |
| 316 |
|
method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors |
| 317 |
|
expected: status ok |
| 318 |
|
''' |
| 319 |
|
connect.create_partition(jac_collection, tag) |
| 320 |
|
nb = 10 |
| 321 |
|
vectors, entities = gen_binary_entities(nb) |
| 322 |
|
ids = connect.insert(jac_collection, entities, partition_tag=tag) |
| 323 |
|
connect.flush([jac_collection]) |
| 324 |
|
stats = connect.get_collection_stats(jac_collection) |
| 325 |
|
vector_ids = connect.list_id_in_segment(jac_collection, stats["partitions"][1]["segments"][0]["id"]) |
| 326 |
|
# vector_ids should match ids |
| 327 |
|
assert len(vector_ids) == nb |
| 328 |
|
for i in range(nb): |
| 329 |
|
assert vector_ids[i] == ids[i] |
| 330 |
|
|
| 331 |
|
@pytest.fixture( |
| 332 |
|
scope="function", |
|
@@ 296-311 (lines=16) @@
|
| 293 |
|
The following cases are used to test `list_id_in_segment` function |
| 294 |
|
****************************************************************** |
| 295 |
|
""" |
| 296 |
|
def test_list_id_in_segment_without_index_A(self, connect, jac_collection): |
| 297 |
|
''' |
| 298 |
|
target: get vector ids when there is no index |
| 299 |
|
method: call list_id_in_segment and check if the segment contains vectors |
| 300 |
|
expected: status ok |
| 301 |
|
''' |
| 302 |
|
nb = 10 |
| 303 |
|
vectors, entities = gen_binary_entities(nb) |
| 304 |
|
ids = connect.insert(jac_collection, entities) |
| 305 |
|
connect.flush([jac_collection]) |
| 306 |
|
stats = connect.get_collection_stats(jac_collection) |
| 307 |
|
vector_ids = connect.list_id_in_segment(jac_collection, stats["partitions"][0]["segments"][0]["id"]) |
| 308 |
|
# vector_ids should match ids |
| 309 |
|
assert len(vector_ids) == nb |
| 310 |
|
for i in range(nb): |
| 311 |
|
assert vector_ids[i] == ids[i] |
| 312 |
|
|
| 313 |
|
def test_list_id_in_segment_without_index_B(self, connect, jac_collection): |
| 314 |
|
''' |