Ejemplo n.º 1
0
  def test_send_service_errors(self):
    self.assertIsInstance(config._router, router._Router)
    self.assertIsInstance(config.cache.get('default_event'), ChromeInfraEvent)

    self.assertFalse(event_mon.send_service_event('invalid'))
    self.assertFalse(event_mon.send_service_event('START',
                                                   timestamp_kind='invalid'))
    self.assertFalse(event_mon.send_service_event(
      'START', event_timestamp='2015-01-25'))
Ejemplo n.º 2
0
  def test_send_service_event_smoke(self):
    self.assertIsInstance(config._router, router._Router)
    self.assertIsInstance(config.cache.get('default_event'), ChromeInfraEvent)

    self.assertTrue(event_mon.send_service_event('START'))
    self.assertTrue(event_mon.send_service_event('START',
                                                 timestamp_kind=None))
    self.assertTrue(event_mon.send_service_event('START',
                                                  timestamp_kind='BEGIN'))
    self.assertTrue(event_mon.send_service_event('STOP',
                                                  timestamp_kind='END',
                                                  event_timestamp=1234))
Ejemplo n.º 3
0
def send_service_event(args):
  """Entry point when --service-event-type is passed."""
  revinfo = {}
  if args.service_event_revinfo:
    if args.service_event_revinfo == '-':  # pragma: no cover
      revinfo = event_mon.parse_revinfo(sys.stdin.read())
    else:
      with open(args.service_event_revinfo, 'r') as f:
        revinfo = event_mon.parse_revinfo(f.read())
  elif args.service_event_revinfo_from_gclient:  # pragma: no cover
    revinfo = event_mon.get_revinfo()

  if args.service_event_stack_trace:
    args.service_event_type = 'CRASH'

  return bool(event_mon.send_service_event(
    args.service_event_type,
    code_version=revinfo.values(),
    stack_trace=args.service_event_stack_trace,
    timestamp_kind=args.event_mon_timestamp_kind,
    event_timestamp=args.event_mon_event_timestamp))
Ejemplo n.º 4
0
def send_service_event(args):
    """Entry point when --service-event-type is passed."""
    revinfo = {}
    if args.service_event_revinfo:
        if args.service_event_revinfo == '-':  # pragma: no cover
            revinfo = event_mon.parse_revinfo(sys.stdin.read())
        else:
            with open(args.service_event_revinfo, 'r') as f:
                revinfo = event_mon.parse_revinfo(f.read())
    elif args.service_event_revinfo_from_gclient:  # pragma: no cover
        revinfo = event_mon.get_revinfo()

    if args.service_event_stack_trace:
        args.service_event_type = 'CRASH'

    return bool(
        event_mon.send_service_event(
            args.service_event_type,
            code_version=revinfo.values(),
            stack_trace=args.service_event_stack_trace,
            timestamp_kind=args.event_mon_timestamp_kind,
            event_timestamp=args.event_mon_event_timestamp))