Beispiel #1
0
    def testGoodProvision(self):
        """Test a provision that pass."""
        repair_status_log = self.fetchTestLogs('good-provision-status.log')

        result = classifier.ClassifyLabJobStatusResult(repair_status_log)

        self.assertEqual(result, 'provision: GOOD: No details extracted.')
Beispiel #2
0
    def testFailRepair(self):
        """Test a repair that failed."""
        repair_status_log = self.fetchTestLogs('fail-repair-status.log')

        result = classifier.ClassifyLabJobStatusResult(repair_status_log)

        self.assertEqual(result, 'repair: FAIL: NetworkWasDown, USB')
Beispiel #3
0
    def testNetDownRepair(self):
        """A successful repair with the network down."""
        repair_status_log = self.fetchTestLogs('net-down-repair-status.log')

        result = classifier.ClassifyLabJobStatusResult(repair_status_log)

        self.assertEqual(result, 'repair: GOOD: NetworkWasDown')
Beispiel #4
0
    def testUsbRepair(self):
        """A successful repair with the network down, and recovery used."""
        repair_status_log = self.fetchTestLogs('usb-repair-status.log')

        result = classifier.ClassifyLabJobStatusResult(repair_status_log)

        self.assertEqual(result, 'repair: GOOD: NetworkWasDown, USB')
Beispiel #5
0
    def testNoopRepair(self):
        """Sometimes repairs don't have to do anything at all."""
        repair_status_log = self.fetchTestLogs('noop-repair-status.log')

        result = classifier.ClassifyLabJobStatusResult(repair_status_log)

        self.assertEqual(result, 'repair: GOOD: NoRepairNeeded')
Beispiel #6
0
def ClassifySpecialTask(base_url):
  """Classify a single special task.

  Args:
    base_url: The GS URL to the special task directory.
  """
  ctx = gs.GSContext()
  STATUS_LOG = 'status.log'
  glob_url = os.path.join(base_url, '*', STATUS_LOG)
  try:
    files = ctx.LS(glob_url)
    content = ctx.Cat(files[0])
    result = classifier.ClassifyLabJobStatusResult(content.splitlines())
    logging.info('%s: %s', base_url, result)
  except gs.GSNoSuchKey:
    logging.warning('%s: %s not found', base_url, STATUS_LOG)