Code Duplication    Length = 18-19 lines in 5 locations

tests/milvus_python_test/entity/test_insert.py 5 locations

@@ 1017-1035 (lines=19) @@
1014
        status = connect.create_index(ip_collection, index_type, index_param)
1015
        assert status.OK()
1016
1017
    @pytest.mark.timeout(ADD_TIMEOUT)
1018
    def test_add_vector_sleep_create_index_another(self, connect, ip_collection, get_simple_index):
1019
        '''
1020
        target: test add vector to collection_2 after build index for collection_1 for a while
1021
        method: build index and add vector
1022
        expected: status ok
1023
        '''
1024
        index_param = get_simple_index["index_param"]
1025
        index_type = get_simple_index["index_type"]
1026
        param = {'collection_name': gen_unique_str(),
1027
                 'dimension': dim,
1028
                 'index_file_size': index_file_size,
1029
                 'metric_type': MetricType.L2}
1030
        status = connect.create_collection(param)
1031
        vector = gen_single_vector(dim)
1032
        status, ids = connect.insert(ip_collection, vector)
1033
        connect.flush([ip_collection])
1034
        status = connect.create_index(
1035
            param['collection_name'], index_type, index_param)
1036
        assert status.OK()
1037
1038
    @pytest.mark.timeout(ADD_TIMEOUT)
@@ 257-275 (lines=19) @@
254
        status = connect.create_index(collection, index_type, index_param)
255
        assert status.OK()
256
257
    @pytest.mark.timeout(ADD_TIMEOUT)
258
    def test_add_vector_sleep_create_index_another(self, connect, collection, get_simple_index):
259
        '''
260
        target: test add vector to collection_2 after build index for collection_1 for a while
261
        method: build index and add vector
262
        expected: status ok
263
        '''
264
        index_param = get_simple_index["index_param"]
265
        index_type = get_simple_index["index_type"]
266
        param = {'collection_name': gen_unique_str(),
267
                 'dimension': dim,
268
                 'index_file_size': index_file_size,
269
                 'metric_type': MetricType.L2}
270
        status = connect.create_collection(param)
271
        vector = gen_single_vector(dim)
272
        status, ids = connect.insert(collection, vector)
273
        connect.flush([collection])
274
        status = connect.create_index(
275
            param['collection_name'], index_type, index_param)
276
        assert status.OK()
277
278
    @pytest.mark.timeout(ADD_TIMEOUT)
@@ 979-996 (lines=18) @@
976
        else:
977
            assert status.OK()
978
979
    @pytest.mark.timeout(ADD_TIMEOUT)
980
    def test_add_vector_create_index_another(self, connect, ip_collection, get_simple_index):
981
        '''
982
        target: test add vector to collection_2 after build index for collection_1
983
        method: build index and add vector
984
        expected: status ok
985
        '''
986
        index_param = get_simple_index["index_param"]
987
        index_type = get_simple_index["index_type"]
988
        param = {'collection_name': gen_unique_str(),
989
                 'dimension': dim,
990
                 'index_file_size': index_file_size,
991
                 'metric_type': MetricType.L2}
992
        status = connect.create_collection(param)
993
        vector = gen_single_vector(dim)
994
        status, ids = connect.insert(ip_collection, vector)
995
        status = connect.create_index(
996
            param['collection_name'], index_type, index_param)
997
        assert status.OK()
998
999
    @pytest.mark.timeout(ADD_TIMEOUT)
@@ 222-239 (lines=18) @@
219
        status = connect.create_index(collection, index_type, index_param)
220
        assert status.OK()
221
222
    @pytest.mark.timeout(ADD_TIMEOUT)
223
    def test_add_vector_create_index_another(self, connect, collection, get_simple_index):
224
        '''
225
        target: test add vector to collection_2 after build index for collection_1
226
        method: build index and add vector
227
        expected: status ok
228
        '''
229
        index_param = get_simple_index["index_param"]
230
        index_type = get_simple_index["index_type"]
231
        param = {'collection_name': gen_unique_str(),
232
                 'dimension': dim,
233
                 'index_file_size': index_file_size,
234
                 'metric_type': MetricType.L2}
235
        status = connect.create_collection(param)
236
        vector = gen_single_vector(dim)
237
        status, ids = connect.insert(collection, vector)
238
        status = connect.create_index(
239
            param['collection_name'], index_type, index_param)
240
        assert status.OK()
241
242
    @pytest.mark.timeout(ADD_TIMEOUT)
@@ 187-205 (lines=19) @@
184
        status, ids = connect.insert(collection, vector)
185
        assert status.OK()
186
187
    @pytest.mark.timeout(ADD_TIMEOUT)
188
    def test_create_index_add_vector_another(self, connect, collection, get_simple_index):
189
        '''
190
        target: test add vector to collection_2 after build index for collection_1
191
        method: build index and add vector
192
        expected: status ok
193
        '''
194
        index_param = get_simple_index["index_param"]
195
        index_type = get_simple_index["index_type"]
196
        param = {'collection_name': gen_unique_str(),
197
                 'dimension': dim,
198
                 'index_file_size': index_file_size,
199
                 'metric_type': MetricType.L2}
200
        status = connect.create_collection(param)
201
        status = connect.create_index(collection, index_type, index_param)
202
        vector = gen_single_vector(dim)
203
        status, ids = connect.insert(collection, vector)
204
        connect.drop_collection(param['collection_name'])
205
        assert status.OK()
206
207
    @pytest.mark.timeout(ADD_TIMEOUT)
208
    def test_add_vector_create_index(self, connect, collection, get_simple_index):