Пример #1
0
 def testGetLogNoStream(self):
     annotations = _CreateProtobufMessage(self.step_name,
                                          self.stdout_stream,
                                          self.step_metadata_stream)
     self.assertIsNone(
         logdog_util._GetLog(annotations, 'NOT' + self.step_name, 'stdout',
                             self.http_client))
Пример #2
0
 def testGetLogNoHost(self):
   annotations = _CreateProtobufMessage(self.step_name, self.stdout_stream,
                                        self.step_metadata_stream)
   env = annotations.command.environ
   env['LOGDOG_STREAM_PREFIX'] = 'path'
   env['LOGDOG_STREAM_PROJECT'] = 'project'
   self.assertIsNone(
       logdog_util._GetLog(annotations, self.step_name, 'stdout',
                           self.http_client))
Пример #3
0
 def testGetLogRequestFail(self, mock_log, _):
   annotations = _CreateProtobufMessage(self.step_name, self.stdout_stream,
                                        self.step_metadata_stream)
   env = annotations.command.environ
   env['LOGDOG_STREAM_PREFIX'] = 'path'
   env['LOGDOG_COORDINATOR_HOST'] = 'logdog.com'
   env['LOGDOG_STREAM_PROJECT'] = 'project'
   self.assertIsNone(
       logdog_util._GetLog(annotations, self.step_name, 'stdout',
                           self.http_client))
   url = ('https://logdog.com/logs/project/path/+/%s?format=raw' %
          self.stdout_stream)
   mock_log.assert_called_once_with(
       'Failed to get the log from %s: status_code-%d, log-%s', url, 404, None)
Пример #4
0
  def testGetLog(self, mock_get):
    annotations = _CreateProtobufMessage(self.step_name, self.stdout_stream,
                                         self.step_metadata_stream)
    env = annotations.command.environ
    env['LOGDOG_STREAM_PREFIX'] = 'path'
    env['LOGDOG_COORDINATOR_HOST'] = 'logdog.com'
    env['LOGDOG_STREAM_PROJECT'] = 'project'

    dummy_result = {"a": "b"}
    mock_get.return_value = (200, dummy_result, 'header')
    self.assertEqual(
        dummy_result,
        logdog_util._GetLog(annotations, self.step_name, 'step_metadata',
                            self.http_client))
    mock_get.assert_called_once_with(
        'https://logdog.com/logs/project/path/+/%s?format=raw' %
        self.step_metadata_stream)
Пример #5
0
 def testGetLogNoAnnotations(self):
     self.assertIsNone(
         logdog_util._GetLog(None, self.step_name, 'stdout',
                             self.http_client))