Code Duplication    Length = 23-24 lines in 2 locations

tests/milvus_python_test/test_compact.py 2 locations

@@ 336-359 (lines=24) @@
333
            status = connect.compact(collection_list[i])
334
            assert status.OK()
335
336
    @pytest.mark.level(2)
337
    @pytest.mark.timeout(COMPACT_TIMEOUT)
338
    def test_add_entity_after_compact(self, connect, collection):
339
        '''
340
        target: test add entity after compact
341
        method: after compact operation, add entity
342
        expected: status ok, entity added
343
        '''
344
        ids = connect.insert(collection, entities)
345
        assert len(ids) == nb
346
        connect.flush([collection])
347
        # get collection info before compact
348
        info = connect.get_collection_stats(collection)
349
        size_before = info["partitions"][0]["segments"][0]["data_size"]
350
        status = connect.compact(collection)
351
        assert status.OK()
352
        # get collection info after compact
353
        info = connect.get_collection_stats(collection)
354
        size_after = info["partitions"][0]["segments"][0]["data_size"]
355
        assert(size_before == size_after)
356
        ids = connect.insert(collection, entity)
357
        connect.flush([collection])
358
        res = connect.count_entities(collection)
359
        assert res == nb+1
360
361
    @pytest.mark.skip(reason="delete not support yet")
362
    @pytest.mark.timeout(COMPACT_TIMEOUT)
@@ 640-662 (lines=23) @@
637
            status = connect.drop_collection(collection_list[i])
638
            assert status.OK()
639
640
    @pytest.mark.level(2)
641
    @pytest.mark.timeout(COMPACT_TIMEOUT)
642
    def test_add_entity_after_compact(self, connect, binary_collection):
643
        '''
644
        target: test add entity after compact
645
        method: after compact operation, add entity
646
        expected: status ok, entity added
647
        '''
648
        ids = connect.insert(binary_collection, binary_entities)
649
        connect.flush([binary_collection])
650
        # get collection info before compact
651
        info = connect.get_collection_stats(binary_collection)
652
        size_before = info["partitions"][0]["segments"][0]["data_size"]
653
        status = connect.compact(binary_collection)
654
        assert status.OK()
655
        # get collection info after compact
656
        info = connect.get_collection_stats(binary_collection)
657
        size_after = info["partitions"][0]["segments"][0]["data_size"]
658
        assert(size_before == size_after)
659
        ids = connect.insert(binary_collection, binary_entity)
660
        connect.flush([binary_collection])
661
        res = connect.count_entities(binary_collection)
662
        assert res == nb + 1
663
664
    @pytest.mark.timeout(COMPACT_TIMEOUT)
665
    @pytest.mark.skip(reason="delete not support yet")