Code Duplication    Length = 14-14 lines in 5 locations

tests/milvus_python_test/test_config.py 5 locations

@@ 752-765 (lines=14) @@
749
            status, reply = connect.set_config("gpu", "search_devices", i)
750
            assert not status.OK()
751
752
    @pytest.mark.timeout(CONFIG_TIMEOUT)
753
    def test_set_build_index_devices_invalid_parent_key(self, connect, collection):
754
        '''
755
        target: set invalid parent key
756
        method: call set_config without parent_key: gpu
757
        expected: status not ok
758
        '''
759
        if str(connect._cmd("mode")[1]) == "CPU":
760
            pytest.skip("Only support GPU mode")
761
        invalid_configs = ["Gpu_resource_config", "gpu resource config", \
762
            "gpu_resource"]
763
        for config in invalid_configs:
764
            status, reply = connect.set_config(config, "build_index_devices", "gpu0")
765
            assert not status.OK()
766
767
    @pytest.mark.timeout(CONFIG_TIMEOUT)
768
    def test_set_build_index_devices_valid(self, connect, collection):
@@ 710-723 (lines=14) @@
707
            status, reply = connect.set_config("gpu", "cache_size", i)
708
            assert not status.OK()
709
710
    @pytest.mark.timeout(CONFIG_TIMEOUT)
711
    def test_set_search_devices_invalid_parent_key(self, connect, collection):
712
        '''
713
        target: set invalid parent key
714
        method: call set_config without parent_key: gpu
715
        expected: status not ok
716
        '''
717
        if str(connect._cmd("mode")[1]) == "CPU":
718
            pytest.skip("Only support GPU mode")
719
        invalid_configs = ["Gpu_resource_config", "gpu resource config", \
720
            "gpu_resource"]
721
        for config in invalid_configs:
722
            status, reply = connect.set_config(config, "search_devices", "gpu0")
723
            assert not status.OK()
724
725
    @pytest.mark.timeout(CONFIG_TIMEOUT)
726
    def test_set_search_devices_valid(self, connect, collection):
@@ 668-681 (lines=14) @@
665
            assert status.OK()
666
            assert config_value == str(config)
667
668
    @pytest.mark.timeout(CONFIG_TIMEOUT)
669
    def test_set_cache_size_invalid_parent_key(self, connect, collection):
670
        '''
671
        target: set invalid parent key
672
        method: call set_config without parent_key: gpu
673
        expected: status not ok
674
        '''
675
        if str(connect._cmd("mode")[1]) == "CPU":
676
            pytest.skip("Only support GPU mode")
677
        invalid_configs = ["Gpu_resource_config", "gpu resource config", \
678
            "gpu_resource"]
679
        for config in invalid_configs:
680
            status, reply = connect.set_config(config, "cache_size", 2)
681
            assert not status.OK()
682
683
    @pytest.mark.timeout(CONFIG_TIMEOUT)
684
    def test_set_cache_size_valid(self, connect, collection):
@@ 623-636 (lines=14) @@
620
            status, reply = connect.set_config(config, "enable", "true")
621
            assert not status.OK()
622
623
    @pytest.mark.timeout(CONFIG_TIMEOUT)
624
    def test_set_gpu_invalid_child_key(self, connect, collection):
625
        '''
626
        target: set invalid child key
627
        method: call set_config with invalid child_key
628
        expected: status not ok
629
        '''
630
        if str(connect._cmd("mode")[1]) == "CPU":
631
            pytest.skip("Only support GPU mode")
632
        invalid_configs = ["Gpu_resource_config", "gpu resource config", \
633
            "gpu_resource"]
634
        for config in invalid_configs:
635
            status, reply = connect.set_config("gpu", config, "true")
636
            assert not status.OK()
637
638
    @pytest.mark.timeout(CONFIG_TIMEOUT)
639
    def test_set_gpu_enable_invalid_values(self, connect, collection):
@@ 608-621 (lines=14) @@
605
      The following cases are used to test `set_config` function
606
    ******************************************************************
607
    """
608
    @pytest.mark.timeout(CONFIG_TIMEOUT)
609
    def test_set_gpu_enable_invalid_parent_key(self, connect, collection):
610
        '''
611
        target: set invalid parent key
612
        method: call set_config without parent_key: gpu
613
        expected: status not ok
614
        '''
615
        if str(connect._cmd("mode")[1]) == "CPU":
616
            pytest.skip("Only support GPU mode")
617
        invalid_configs = ["Gpu_resource_config", "gpu resource config", \
618
            "gpu_resource"]
619
        for config in invalid_configs:
620
            status, reply = connect.set_config(config, "enable", "true")
621
            assert not status.OK()
622
623
    @pytest.mark.timeout(CONFIG_TIMEOUT)
624
    def test_set_gpu_invalid_child_key(self, connect, collection):