Ejemplo n.º 1
0
 def test_unavailable(self):
     mock_run_smartctl = self.patch(smartctl, "run_smartctl")
     mock_run_smartctl.return_value = ("Product: %s\n"
                                       "SMART support is: Unavailable\n" %
                                       factory.make_name("product"))
     mock_exit_skipped = self.patch(smartctl, "exit_skipped")
     smartctl.check_SMART_support(factory.make_name("blockdevice"))
     self.assertThat(mock_exit_skipped, MockCalledOnce())
Ejemplo n.º 2
0
 def test_available2(self):
     mock_run_smartctl = self.patch(smartctl, "run_smartctl")
     mock_run_smartctl.return_value = (
         "SMART overall-health self-assessment test result: ")
     self.assertItemsEqual(
         [None, []],
         smartctl.check_SMART_support(factory.make_name("blockdevice")),
     )
Ejemplo n.º 3
0
 def test_available(self):
     mock_run_smartctl = self.patch(smartctl, "run_smartctl")
     mock_run_smartctl.return_value = ("Product: %s\n"
                                       "SMART support is: Available\n" %
                                       factory.make_name("product"))
     self.assertItemsEqual(
         [None, []],
         smartctl.check_SMART_support(factory.make_name("blockdevice")),
     )
Ejemplo n.º 4
0
 def test_available_megaraid(self):
     mock_run_smartctl = self.patch(smartctl, "run_smartctl")
     mock_run_smartctl.return_value = ("Product: MegaRAID\n"
                                       "SMART support is: Unavailable\n")
     scsi_ids = [random.randint(0, 127) for _ in range(3)]
     self.patch(smartctl, "detect_megaraid_config").return_value = scsi_ids
     self.assertItemsEqual(
         ["megaraid", scsi_ids],
         smartctl.check_SMART_support(factory.make_name("blockdevice")),
     )