diff --git a/tests/python_client/testcases/test_compaction.py b/tests/python_client/testcases/test_compaction.py index 31cfd8baf7..5581ddb070 100644 --- a/tests/python_client/testcases/test_compaction.py +++ b/tests/python_client/testcases/test_compaction.py @@ -236,7 +236,15 @@ class TestCompactionParams(TestcaseBase): # Flush a new segment and meet condition 20% deleted entities, triggre compaction but no way to get plan collection_w.insert(cf.gen_default_dataframe_data(1, start=tmp_nb)) - assert collection_w.num_entities == tmp_nb + 1 + + exp_num_entities_after_compact = tmp_nb - (tmp_nb // ct.compact_delta_ratio_reciprocal) + 1 + start = time() + while True: + if collection_w.num_entities == exp_num_entities_after_compact: + break + if time() - start > 60: + raise MilvusException(1, "Auto delete ratio compaction cost more than 60s") + sleep(1) collection_w.create_index(ct.default_float_vec_field_name, index_params=ct.default_flat_index) collection_w.load() diff --git a/tests/python_client/testcases/test_delete.py b/tests/python_client/testcases/test_delete.py index 78febe2790..c494c7f91a 100644 --- a/tests/python_client/testcases/test_delete.py +++ b/tests/python_client/testcases/test_delete.py @@ -387,7 +387,7 @@ class TestDeleteOperation(TestcaseBase): # delete half and flush expr = f'{ct.default_int64_field_name} in {insert_res.primary_keys[:ct.default_nb // 2]}' del_res, _ = collection_w.delete(expr) - assert collection_w.num_entities == ct.default_nb + assert collection_w.num_entities in [ct.default_nb, ct.default_nb // 2] # create index index_params = {"index_type": "IVF_SQ8",