|
@@ 530-552 (lines=23) @@
|
| 527 |
|
logging.getLogger().info(size_after) |
| 528 |
|
assert(size_before >= size_after) |
| 529 |
|
|
| 530 |
|
@pytest.mark.timeout(COMPACT_TIMEOUT) |
| 531 |
|
@pytest.mark.skip(reason="delete not support yet") |
| 532 |
|
def test_insert_delete_all_and_compact(self, connect, binary_collection): |
| 533 |
|
''' |
| 534 |
|
target: test add entities, delete them and compact |
| 535 |
|
method: add entities, delete all and compact collection |
| 536 |
|
expected: status ok, no data size in collection info because collection is empty |
| 537 |
|
''' |
| 538 |
|
ids = connect.insert(binary_collection, binary_entities) |
| 539 |
|
assert len(ids) == nb |
| 540 |
|
connect.flush([binary_collection]) |
| 541 |
|
status = connect.delete_entity_by_id(binary_collection, ids) |
| 542 |
|
assert status.OK() |
| 543 |
|
connect.flush([binary_collection]) |
| 544 |
|
# get collection info before compact |
| 545 |
|
info = connect.get_collection_stats(binary_collection) |
| 546 |
|
status = connect.compact(binary_collection) |
| 547 |
|
assert status.OK() |
| 548 |
|
# get collection info after compact |
| 549 |
|
info = connect.get_collection_stats(binary_collection) |
| 550 |
|
assert status.OK() |
| 551 |
|
logging.getLogger().info(info["partitions"]) |
| 552 |
|
assert not info["partitions"][0]["segments"] |
| 553 |
|
|
| 554 |
|
# TODO |
| 555 |
|
@pytest.mark.level(2) |
|
@@ 162-183 (lines=22) @@
|
| 159 |
|
logging.getLogger().info(size_after) |
| 160 |
|
assert(size_before >= size_after) |
| 161 |
|
|
| 162 |
|
@pytest.mark.timeout(COMPACT_TIMEOUT) |
| 163 |
|
@pytest.mark.skip(reason="delete not support yet") |
| 164 |
|
def test_insert_delete_all_and_compact(self, connect, collection): |
| 165 |
|
''' |
| 166 |
|
target: test add entities, delete them and compact |
| 167 |
|
method: add entities, delete all and compact collection |
| 168 |
|
expected: status ok, no data size in collection info because collection is empty |
| 169 |
|
''' |
| 170 |
|
ids = connect.insert(collection, entities) |
| 171 |
|
assert len(ids) == nb |
| 172 |
|
connect.flush([collection]) |
| 173 |
|
status = connect.delete_entity_by_id(collection, ids) |
| 174 |
|
assert status.OK() |
| 175 |
|
connect.flush([collection]) |
| 176 |
|
# get collection info before compact |
| 177 |
|
info = connect.get_collection_stats(collection) |
| 178 |
|
status = connect.compact(collection) |
| 179 |
|
assert status.OK() |
| 180 |
|
# get collection info after compact |
| 181 |
|
info = connect.get_collection_stats(collection) |
| 182 |
|
logging.getLogger().info(info["partitions"]) |
| 183 |
|
assert not info["partitions"][0]["segments"] |
| 184 |
|
|
| 185 |
|
@pytest.mark.timeout(COMPACT_TIMEOUT) |
| 186 |
|
@pytest.mark.skip(reason="delete not support yet") |