diff --git a/tests/python_client/testcases/test_delete.py b/tests/python_client/testcases/test_delete.py index c494c7f91a9ad0e86995cf05b5870997fcf4f284..69335ce88aec1cc2209dab3e04b89bae9cafd8a5 100644 --- a/tests/python_client/testcases/test_delete.py +++ b/tests/python_client/testcases/test_delete.py @@ -1250,8 +1250,8 @@ class TestDeleteString(TestcaseBase): # delete half and flush expr = f'{ct.default_string_field_name} in {insert_res.primary_keys[:ct.default_nb // 2]}' expr = expr.replace("'", "\"") - del_res, _ = collection_w.delete(expr) - assert collection_w.num_entities == ct.default_nb + collection_w.delete(expr) + collection_w.flush() # create index index_params = {"index_type": "IVF_SQ8", @@ -1260,6 +1260,8 @@ class TestDeleteString(TestcaseBase): assert collection_w.has_index()[0] collection_w.load() + res = collection_w.query(expr="", output_fields=["count(*)"])[0] + assert res[0]["count(*)"] == ct.default_nb // 2 search_res, _ = collection_w.search([df[ct.default_float_vec_field_name][0]], ct.default_float_vec_field_name, ct.default_search_params, ct.default_limit) diff --git a/tests/python_client/testcases/test_insert.py b/tests/python_client/testcases/test_insert.py index 1c724689a7e7bd97e83d37d04920367a2db2d88a..01f35a05a0d74a0f7b9607f2ef2a4bad3ec89b5e 100644 --- a/tests/python_client/testcases/test_insert.py +++ b/tests/python_client/testcases/test_insert.py @@ -1535,10 +1535,13 @@ class TestUpsertValid(TestcaseBase): upsert_nb = 1000 collection_w = self.init_collection_general(pre_upsert, True)[0] # upsert + step = 500 for i in range(10): - data = cf.gen_default_data_for_upsert(upsert_nb, start=i*500)[0] + data = cf.gen_default_data_for_upsert(upsert_nb, start=i*step)[0] collection_w.upsert(data) - assert collection_w.num_entities == upsert_nb*10 + ct.default_nb + # check the result + res = collection_w.query(expr="", output_fields=["count(*)"])[0] + assert res[0]["count(*)"] == upsert_nb * 10 - step * 9 @pytest.mark.tags(CaseLabel.L2) def test_upsert_pk_string_multiple_times(self): @@ -1554,12 +1557,17 @@ class TestUpsertValid(TestcaseBase): name = cf.gen_unique_str(pre_upsert) collection_w = self.init_collection_wrap(name, schema) collection_w.insert(cf.gen_default_list_data()) - # upsert + step = 500 for i in range(10): - data = cf.gen_default_list_data(upsert_nb, start=i * 500) + data = cf.gen_default_list_data(upsert_nb, start=i * step) collection_w.upsert(data) - assert collection_w.num_entities == upsert_nb * 10 + ct.default_nb + # load + collection_w.create_index(ct.default_float_vec_field_name, default_index_params) + collection_w.load() + # check the result + res = collection_w.query(expr="", output_fields=["count(*)"])[0] + assert res[0]["count(*)"] == upsert_nb * 10 - step * 9 class TestUpsertInvalid(TestcaseBase):