Code Duplication    Length = 26-26 lines in 2 locations

tests/milvus_python_test/test_compact.py 2 locations

@@ 555-580 (lines=26) @@
552
        assert not info["partitions"][0]["segments"]
553
554
    # TODO
555
    @pytest.mark.level(2)
556
    @pytest.mark.timeout(COMPACT_TIMEOUT)
557
    def test_add_entity_and_compact_twice(self, connect, binary_collection):
558
        '''
559
        target: test add entity and compact twice
560
        method: add entity and compact collection twice
561
        expected: status ok
562
        '''
563
        ids = connect.insert(binary_collection, binary_entity)
564
        assert len(ids) == 1
565
        connect.flush([binary_collection])
566
        # get collection info before compact
567
        info = connect.get_collection_stats(binary_collection)
568
        size_before = info["partitions"][0]["segments"][0]["data_size"]
569
        status = connect.compact(binary_collection)
570
        assert status.OK()
571
        # get collection info after compact
572
        info = connect.get_collection_stats(binary_collection)
573
        size_after = info["partitions"][0]["segments"][0]["data_size"]
574
        assert(size_before == size_after)
575
        status = connect.compact(binary_collection)
576
        assert status.OK()
577
        # get collection info after compact twice
578
        info = connect.get_collection_stats(binary_collection)
579
        size_after_twice = info["partitions"][0]["segments"][0]["data_size"]
580
        assert(size_after == size_after_twice)
581
582
    @pytest.mark.timeout(COMPACT_TIMEOUT)
583
    @pytest.mark.skip(reason="delete not support yet")
@@ 256-281 (lines=26) @@
253
        assert(size_before >= size_after)
254
255
    # TODO
256
    @pytest.mark.level(2)
257
    @pytest.mark.timeout(COMPACT_TIMEOUT)
258
    def test_add_entity_and_compact_twice(self, connect, collection):
259
        '''
260
        target: test add entity and compact twice
261
        method: add entity and compact collection twice
262
        expected: status ok, data size no change
263
        '''
264
        ids = connect.insert(collection, entity)
265
        connect.flush([collection])
266
        # get collection info before compact
267
        info = connect.get_collection_stats(collection)
268
        size_before = info["partitions"][0]["segments"][0]["data_size"]
269
        status = connect.compact(collection)
270
        assert status.OK()
271
        connect.flush([collection])
272
        # get collection info after compact
273
        info = connect.get_collection_stats(collection)
274
        size_after = info["partitions"][0]["segments"][0]["data_size"]
275
        assert(size_before == size_after)
276
        status = connect.compact(collection)
277
        assert status.OK()
278
        # get collection info after compact twice
279
        info = connect.get_collection_stats(collection)
280
        size_after_twice = info["partitions"][0]["segments"][0]["data_size"]
281
        assert(size_after == size_after_twice)
282
283
    @pytest.mark.timeout(COMPACT_TIMEOUT)
284
    @pytest.mark.skip(reason="delete not support yet")