Code Duplication    Length = 13-14 lines in 6 locations

tests/milvus_python_test/test_config.py 6 locations

@@ 560-573 (lines=14) @@
557
        logging.getLogger().info(config_value)
558
        assert status.OK()
559
    
560
    @pytest.mark.level(2)
561
    def test_get_build_index_devices_invalid_parent_key(self, connect, collection):
562
        '''
563
        target: get invalid parent key
564
        method: call get_config without parent_key: gpu
565
        expected: status not ok
566
        '''
567
        if str(connect._cmd("mode")[1]) == "CPU":
568
            pytest.skip("Only support GPU mode")
569
        invalid_configs = ["Gpu_resource_config", "gpu resource config", \
570
            "gpu_resource"]
571
        for config in invalid_configs:
572
            status, config_value = connect.get_config(config, "build_index_devices")
573
            assert not status.OK()
574
575
    @pytest.mark.level(2)
576
    def test_get_build_index_devices_invalid_child_key(self, connect, collection):
@@ 477-490 (lines=14) @@
474
        assert status.OK()
475
        assert config_value == "true" or config_value == "false"
476
477
    @pytest.mark.level(2)
478
    def test_get_cache_size_invalid_parent_key(self, connect, collection):
479
        '''
480
        target: get invalid parent key
481
        method: call get_config without parent_key: gpu
482
        expected: status not ok
483
        '''
484
        if str(connect._cmd("mode")[1]) == "CPU":
485
            pytest.skip("Only support GPU mode")
486
        invalid_configs = ["Gpu_resource_config", "gpu resource config", \
487
            "gpu_resource"]
488
        for config in invalid_configs:
489
            status, config_value = connect.get_config(config, "cache_size")
490
            assert not status.OK()
491
492
    @pytest.mark.level(2)
493
    def test_get_cache_size_invalid_child_key(self, connect, collection):
@@ 575-587 (lines=13) @@
572
            status, config_value = connect.get_config(config, "build_index_devices")
573
            assert not status.OK()
574
575
    @pytest.mark.level(2)
576
    def test_get_build_index_devices_invalid_child_key(self, connect, collection):
577
        '''
578
        target: get invalid child key
579
        method: call get_config without child_key: build_index_devices
580
        expected: status not ok
581
        '''
582
        if str(connect._cmd("mode")[1]) == "CPU":
583
            pytest.skip("Only support GPU mode")
584
        invalid_configs = ["Build_index_resources"]
585
        for config in invalid_configs:
586
            status, config_value = connect.get_config("gpu", config)
587
            assert not status.OK()
588
589
    @pytest.mark.timeout(CONFIG_TIMEOUT)
590
    def test_get_build_index_devices_valid(self, connect, collection):
@@ 492-504 (lines=13) @@
489
            status, config_value = connect.get_config(config, "cache_size")
490
            assert not status.OK()
491
492
    @pytest.mark.level(2)
493
    def test_get_cache_size_invalid_child_key(self, connect, collection):
494
        '''
495
        target: get invalid child key
496
        method: call get_config without child_key: cache_size
497
        expected: status not ok
498
        '''
499
        if str(connect._cmd("mode")[1]) == "CPU":
500
            pytest.skip("Only support GPU mode")
501
        invalid_configs = ["Cache_capacity", "cachecapacity"]
502
        for config in invalid_configs:
503
            status, config_value = connect.get_config("gpu", config)
504
            assert not status.OK()
505
506
    @pytest.mark.timeout(CONFIG_TIMEOUT)
507
    def test_get_cache_size_valid(self, connect, collection):
@@ 326-338 (lines=13) @@
323
            status, config_value = connect.get_config(config, "gpu_search_threshold")
324
            assert not status.OK()
325
326
    @pytest.mark.level(2)
327
    def test_get_gpu_search_threshold_invalid_child_key(self, connect, collection):
328
        '''
329
        target: get invalid child key
330
        method: call get_config without child_key: gpu_search_threshold
331
        expected: status not ok
332
        '''
333
        if str(connect._cmd("mode")[1]) == "CPU":
334
            pytest.skip("Only support GPU mode")
335
        invalid_configs = ["Gpu_search_threshold", "gpusearchthreshold"]
336
        for config in invalid_configs:
337
            status, config_value = connect.get_config("gpu", config)
338
            assert not status.OK()
339
340
    @pytest.mark.timeout(CONFIG_TIMEOUT)
341
    def test_get_gpu_search_threshold_valid(self, connect, collection):
@@ 312-324 (lines=13) @@
309
        if args["handler"] == "HTTP":
310
            pytest.skip("skip in http mode")
311
312
    @pytest.mark.level(2)
313
    def test_get_gpu_search_threshold_invalid_parent_key(self, connect, collection):
314
        '''
315
        target: get invalid parent key
316
        method: call get_config without parent_key: gpu
317
        expected: status not ok
318
        '''
319
        if str(connect._cmd("mode")[1]) == "CPU":
320
            pytest.skip("Only support GPU mode")
321
        invalid_configs = ["Engine_config", "engine config"]
322
        for config in invalid_configs:
323
            status, config_value = connect.get_config(config, "gpu_search_threshold")
324
            assert not status.OK()
325
326
    @pytest.mark.level(2)
327
    def test_get_gpu_search_threshold_invalid_child_key(self, connect, collection):