def test_ssd(self): (info, events) = get_data_file_text("single-controller-ssd.txt") c = storcli_check.Controller(info, events, self.logger) result, errors = c.ok() self.assertTrue(result) self.assertTrue(len(errors) == 0)
def test_invalid_events(self): # If the events file is invalid, there should be no events (info, events) = get_data_file_text("single-controller.txt", "invalid-events.txt") c = storcli_check.Controller(info, events, self.logger) result, errors = c.ok() self.assertTrue(result) self.assertFalse(errors)
def test_1(self): (info, events) = get_data_file_text("single-controller-hba.txt") c = storcli_check.Controller(info, events, self.logger) result, errors = c.ok() self.assertTrue(result) self.assertTrue(len(errors) == 0) self.assertTrue("Controller" in repr(c)) self.assertTrue(len(c._vd_info) == 0) self.assertTrue(len(c._pd_info) == 0)
def test_report_as_html(self): (info, events) = get_data_file_text("single-controller-offline.txt") c = storcli_check.Controller(info, events, self.logger) report = c.report_as_html() for substring in [ "<b>PD Status</b>", "24:15 15 Onln", "1/1 RAID10 OfLn", "Firmware Package:" ]: self.assertTrue(substring in report)
def test_missing_drive_count(self): (info, events ) = get_data_file_text("single-controller-missing-drive-count.txt") c = storcli_check.Controller(info, events, self.logger) result, errors = c.ok() self.assertTrue(result) self.assertTrue(len(errors) == 0) self.assertTrue("Controller" in repr(c)) self.assertTrue(len(c._vd_info) == 2) self.assertTrue(len(c._pd_info) == 16) self.assertTrue(c._cv_info) self.assertFalse(c._event_info)
def test_bad_events(self): (info, events) = get_data_file_text("single-controller.txt", "bad-events.txt") c = storcli_check.Controller(info, events, self.logger) result, errors = c.ok() self.assertFalse(result) self.assertTrue(errors) self.assertTrue("Controller" in repr(c)) self.assertTrue(len(c._vd_info) == 2) self.assertTrue(len(c._pd_info) == 16) self.assertTrue(c._cv_info) self.assertTrue(len(c._event_info) == 3)
def test_offline(self): (info, events) = get_data_file_text("single-controller-offline.txt") c = storcli_check.Controller(info, events, self.logger) result, errors = c.ok() self.assertFalse(result) self.assertTrue(len(errors) == 3) self.assertTrue("ofln" in errors[0]) self.assertTrue("offln" in errors[1]) self.assertTrue("offln" in errors[2]) self.assertTrue("Controller" in repr(c)) self.assertTrue(len(c._vd_info) == 2) self.assertTrue(len(c._pd_info) == 16) self.assertTrue(c._cv_info) self.assertFalse(c._event_info)
def test_degraded(self): (info, events) = get_data_file_text("single-controller-degraded.txt") c = storcli_check.Controller(info, events, self.logger) result, errors = c.ok() self.assertFalse(result) self.assertTrue(len(errors) == 3) self.assertTrue([x for x in errors if "dgrd" in x]) self.assertTrue([x for x in errors if "offln" in x]) self.assertTrue([x for x in errors if "failure" in x]) self.assertTrue("Controller" in repr(c)) self.assertTrue(len(c._vd_info) == 2) self.assertTrue(len(c._pd_info) == 16) self.assertTrue(c._cv_info) self.assertFalse(c._event_info)