|
@@ 119-136 (lines=18) @@
|
| 116 |
|
assert len(vector_ids) == nb |
| 117 |
|
assert vector_ids[0] == ids[0] |
| 118 |
|
|
| 119 |
|
def test_list_id_in_segment_without_index_B(self, connect, collection): |
| 120 |
|
''' |
| 121 |
|
target: get vector ids when there is no index but with partition |
| 122 |
|
method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors |
| 123 |
|
expected: status ok |
| 124 |
|
''' |
| 125 |
|
nb = 10 |
| 126 |
|
entities = gen_entities(nb) |
| 127 |
|
connect.create_partition(collection, tag) |
| 128 |
|
ids = connect.insert(collection, entities, partition_tag=tag) |
| 129 |
|
connect.flush([collection]) |
| 130 |
|
stats = connect.get_collection_stats(collection) |
| 131 |
|
assert stats["partitions"][1]["tag"] == tag |
| 132 |
|
vector_ids = connect.list_id_in_segment(collection, stats["partitions"][1]["segments"][0]["id"]) |
| 133 |
|
# vector_ids should match ids |
| 134 |
|
assert len(vector_ids) == nb |
| 135 |
|
for i in range(nb): |
| 136 |
|
assert vector_ids[i] == ids[i] |
| 137 |
|
|
| 138 |
|
@pytest.fixture( |
| 139 |
|
scope="function", |
|
@@ 219-236 (lines=18) @@
|
| 216 |
|
for i in range(nb): |
| 217 |
|
assert vector_ids[i] == ids[i] |
| 218 |
|
|
| 219 |
|
def test_list_id_in_segment_without_index_B(self, connect, ip_collection): |
| 220 |
|
''' |
| 221 |
|
target: get vector ids when there is no index but with partition |
| 222 |
|
method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors |
| 223 |
|
expected: status ok |
| 224 |
|
''' |
| 225 |
|
connect.create_partition(ip_collection, tag) |
| 226 |
|
nb = 10 |
| 227 |
|
entities = gen_entities(nb) |
| 228 |
|
ids = connect.insert(ip_collection, entities, partition_tag=tag) |
| 229 |
|
connect.flush([ip_collection]) |
| 230 |
|
stats = connect.get_collection_stats(ip_collection) |
| 231 |
|
assert stats["partitions"][1]["tag"] == tag |
| 232 |
|
vector_ids = connect.list_id_in_segment(ip_collection, stats["partitions"][1]["segments"][0]["id"]) |
| 233 |
|
# vector_ids should match ids |
| 234 |
|
assert len(vector_ids) == nb |
| 235 |
|
for i in range(nb): |
| 236 |
|
assert vector_ids[i] == ids[i] |
| 237 |
|
|
| 238 |
|
@pytest.fixture( |
| 239 |
|
scope="function", |