Esempio n. 1
0
 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, [])
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 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, [])
Esempio n. 5
0
 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, [])
Esempio n. 6
0
 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)
Esempio n. 7
0
 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)
Esempio n. 8
0
 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)
Esempio n. 9
0
 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)
Esempio n. 10
0
 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)
Esempio n. 11
0
 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)
Esempio n. 12
0
 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)
Esempio n. 13
0
 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)