def test_success(self): report_list = [] report_list.extend( lib._validate_devices(self.resources_el, ["stonith1"])) report_list.extend( lib._validate_devices(self.resources_el, ["stonith1", "stonith2"])) assert_report_item_list_equal(report_list, [])
def test_invalid(self): reporter = MockLibraryReportProcessor() lib._validate_devices(reporter, self.resources_el, ["dummy", "fenceX"]) report = [(severity.ERROR, report_codes.STONITH_RESOURCES_DO_NOT_EXIST, { "stonith_ids": ["dummy", "fenceX"], }, report_codes.FORCE_STONITH_RESOURCE_DOES_NOT_EXIST)] assert_report_item_list_equal(reporter.report_item_list, report)
def test_empty(self): reporter = MockLibraryReportProcessor() lib._validate_devices(reporter, self.resources_el, []) report = [(severity.ERROR, report_codes.REQUIRED_OPTION_IS_MISSING, { "option_type": None, "option_names": ["stonith devices"], }, None)] assert_report_item_list_equal(reporter.report_item_list, report)
def test_success(self): reporter = MockLibraryReportProcessor() lib._validate_devices( reporter, self.resources_el, ["stonith1"] ) lib._validate_devices( reporter, self.resources_el, ["stonith1", "stonith2"] ) assert_report_item_list_equal(reporter.report_item_list, [])
def test_node_invalid_not_forceable(self): reporter = MockLibraryReportProcessor() lib._validate_devices(reporter, self.resources_el, ["dummy", "fenceX"], allow_force=False) report = [(severity.ERROR, report_codes.STONITH_RESOURCES_DO_NOT_EXIST, { "stonith_ids": ["dummy", "fenceX"], }, None)] assert_report_item_list_equal(reporter.report_item_list, report)
def test_invalid_forced(self): reporter = MockLibraryReportProcessor() lib._validate_devices(reporter, self.resources_el, ["dummy", "fenceX"], force_device=True) report = [(severity.WARNING, report_codes.STONITH_RESOURCES_DO_NOT_EXIST, { "stonith_ids": ["dummy", "fenceX"], }, None)] assert_report_item_list_equal(reporter.report_item_list, report)
def test_invalid(self): reporter = MockLibraryReportProcessor() lib._validate_devices(reporter, self.resources_el, ["dummy", "fenceX"]) report = [( severity.ERROR, report_codes.STONITH_RESOURCES_DO_NOT_EXIST, { "stonith_ids": ["dummy", "fenceX"], }, report_codes.FORCE_STONITH_RESOURCE_DOES_NOT_EXIST )] assert_report_item_list_equal(reporter.report_item_list, report)
def test_empty(self): reporter = MockLibraryReportProcessor() lib._validate_devices(reporter, self.resources_el, []) report = [( severity.ERROR, report_codes.REQUIRED_OPTION_IS_MISSING, { "option_type": None, "option_names": ["stonith devices"], }, None )] assert_report_item_list_equal(reporter.report_item_list, report)
def test_node_invalid_not_forceable(self): reporter = MockLibraryReportProcessor() lib._validate_devices( reporter, self.resources_el, ["dummy", "fenceX"], allow_force=False ) report = [( severity.ERROR, report_codes.STONITH_RESOURCES_DO_NOT_EXIST, { "stonith_ids": ["dummy", "fenceX"], }, None )] assert_report_item_list_equal(reporter.report_item_list, report)
def test_invalid_forced(self): reporter = MockLibraryReportProcessor() lib._validate_devices( reporter, self.resources_el, ["dummy", "fenceX"], force_device=True ) report = [( severity.WARNING, report_codes.STONITH_RESOURCES_DO_NOT_EXIST, { "stonith_ids": ["dummy", "fenceX"], }, None )] assert_report_item_list_equal(reporter.report_item_list, report)
def test_empty(self): report_list = lib._validate_devices(self.resources_el, []) report = [(severity.ERROR, report_codes.REQUIRED_OPTIONS_ARE_MISSING, { "option_type": None, "option_names": ["stonith devices"], }, None)] assert_report_item_list_equal(report_list, report)
def test_invalid(self): report_list = lib._validate_devices(self.resources_el, ["dummy", "fenceX"]) report = [( severity.ERROR, report_codes.STONITH_RESOURCES_DO_NOT_EXIST, { "stonith_ids": ["dummy", "fenceX"], }, report_codes.FORCE, )] assert_report_item_list_equal(report_list, report)