Ejemplo n.º 1
0
 def test_get_invalid_option(self, tdev):
     """Tests get_option throws error when invalid option id provided"""
     with pytest.raises(tiflash.TIFlashError):
         result = tiflash.get_option("InvalidOption",
             serno=tdev['serno'],
             connection=tdev['connection'],
             devicetype=tdev['devicetype'])
Ejemplo n.º 2
0
def handle_options(args):
    """Helper function for handling 'option' command"""
    session_args = get_session_args(args)
    # Get Option
    if args.cmd == 'options-get':
        try:
            value = tiflash.get_option(args.optionID, pre_operation=args.operation,
                                   **session_args)
            print(value)
        except Exception as e:
            __exit_with_error(e)

    # Set Option
    elif args.cmd == 'options-set':
        try:
            tiflash.set_option(args.optionID, args.optionVal,
                                post_operation=args.operation, **session_args)
        except Exception as e:
            __exit_with_error(e)

    # Display Option Information
    elif args.cmd == 'options-list':
        options = tiflash.list_options(option_id=args.optionID, **session_args)
        header = "Options (%s):" % args.optionID if args.optionID else "Options:"
        print(header)
        print("-" * len(header))
        __print_options(options)
Ejemplo n.º 3
0
 def test_get_option_invalid_preop(self, tdev):
     """Tests get_option raises error when invalid preop provided"""
     with pytest.raises(tiflash.TIFlashError):
         result = tiflash.get_option(tdev['preop-option'],
           pre_operation="InvalidOperation",
             serno=tdev['serno'],
             connection=tdev['connection'],
             devicetype=tdev['devicetype'])
Ejemplo n.º 4
0
    def test_basic_get_option(self, device):
        """Tests basic get_option function"""
        result = tiflash.get_option("ResetOnRestart",
                                    serno=device['serno'],
                                    connection=device['connection'],
                                    devicetype=device['devicetype'])

        assert result == 'true' or result == 'false'
Ejemplo n.º 5
0
    def test_basic_get_option(self, tdev):
        """Tests basic get_option function"""
        result = tiflash.get_option(tdev['option'],
            serno=tdev['serno'],
            connection=tdev['connection'],
            devicetype=tdev['devicetype'])

        if 'option-val' in tdev.keys():
            assert result == tdev['option-val']
Ejemplo n.º 6
0
    def test_get_option_with_preop(self, tdev):
        """Tests get_option with a preop"""
        if 'preop' not in tdev.keys():
            pytest.skip("No preop provided for device")

        result = tiflash.get_option(tdev['preop-option'],
            pre_operation=tdev['preop'],
            serno=tdev['serno'],
            connection=tdev['connection'],
            devicetype=tdev['devicetype'])
Ejemplo n.º 7
0
    def test_get_option_with_preop(self, device):
        """Tests get_option with a preop"""
        if 'ieee' not in device.keys():
            pytest.skip(
                "No IEEE Address provided in setup.cfg for this device")

        result = tiflash.get_option("DeviceIeeePrimary",
                                    pre_operation="ReadPriIeee",
                                    serno=device['serno'],
                                    connection=device['connection'],
                                    devicetype=device['devicetype'])

        assert result == device['ieee']