Пример #1
0
    def test_acquire_stats(self):
        self.mock(cq_stats, "fetch_json", lambda _: "json")
        self.mock(
            cq_stats,
            "organize_stats",
            lambda *_args, **_kwargs: {"latest": cq_stats.default_stats(), "previous": cq_stats.default_stats()},
        )
        self.mock(cq_stats, "derive_stats", lambda *_args, **_kwargs: {})
        self.mock(cq_stats, "derive_tree_stats", lambda *_: {"open": 0.0, "total": 3600.0})
        self.mock(cq_stats, "derive_git_stats", lambda *_: {})
        self.mock(cq_stats, "derive_svn_stats", lambda *_: {})

        cq_stats.acquire_stats(Args(project="blink", bots=[]))
        cq_stats.acquire_stats(Args(project="chromium", bots=[]))
        cq_stats.acquire_stats(Args(project="chromium", bots=[], use_logs=True, range="week"))
        cq_stats.acquire_stats(Args(project="chromium", bots=[], use_logs=True, range="day"))
        cq_stats.acquire_stats(Args(project="chromium", bots=[], use_logs=True, range="hour"))
Пример #2
0
  def test_acquire_stats(self):
    self.mock(cq_stats, 'fetch_json', lambda _: 'json')
    self.mock(cq_stats, 'organize_stats',
        lambda *_args, **_kwargs: {
            'latest': cq_stats.default_stats(),
            'previous': cq_stats.default_stats()})
    self.mock(cq_stats, 'derive_stats', lambda *_args, **_kwargs: {})
    self.mock(cq_stats, 'derive_tree_stats',
        lambda *_: {'open': 0.0, 'total': 3600.0})
    self.mock(cq_stats, 'derive_git_stats', lambda *_: {})
    self.mock(cq_stats, 'derive_svn_stats', lambda *_: {})

    cq_stats.acquire_stats(Args(project='blink', bots=[]))
    cq_stats.acquire_stats(Args(project='chromium', bots=[]),
                           add_tree_stats=False)
    cq_stats.acquire_stats(Args(
        project='chromium', bots=[], use_logs=True, range='week'))
    cq_stats.acquire_stats(Args(
        project='chromium', bots=[], use_logs=True, range='day'))
    cq_stats.acquire_stats(Args(
        project='chromium', bots=[], use_logs=True, range='hour'))
Пример #3
0
    def test_acquire_stats(self):
        self.mock(cq_stats, 'fetch_json', lambda _: 'json')
        self.mock(
            cq_stats, 'organize_stats', lambda *_args, **_kwargs: {
                'latest': cq_stats.default_stats(),
                'previous': cq_stats.default_stats()
            })
        self.mock(cq_stats, 'derive_stats', lambda *_args, **_kwargs: {})
        self.mock(cq_stats, 'derive_tree_stats', lambda *_: {
            'open': 0.0,
            'total': 3600.0
        })
        self.mock(cq_stats, 'derive_git_stats', lambda *_: {})
        self.mock(cq_stats, 'derive_svn_stats', lambda *_: {})

        cq_stats.acquire_stats(Args(project='blink', bots=[]))
        cq_stats.acquire_stats(Args(project='chromium', bots=[]))
        cq_stats.acquire_stats(
            Args(project='chromium', bots=[], use_logs=True, range='week'))
        cq_stats.acquire_stats(
            Args(project='chromium', bots=[], use_logs=True, range='day'))
        cq_stats.acquire_stats(
            Args(project='chromium', bots=[], use_logs=True, range='hour'))
Пример #4
0
def main(args):
  opts = parse_args(args)

  stats = cq_stats.acquire_stats(
      StatsArgs(opts.project, opts.range), add_tree_stats=False)

  try:
    durations_dist = ts_mon.Distribution(ts_mon.GeometricBucketer())
    for duration in stats['patchset-committed-durations']['raw']:
      durations_dist.add(duration)
    patchset_committed_durations.set(durations_dist)

    attempt_false_reject_count.set(
        sum(p['count'] for p in stats['false-rejections']))
    attempt_count.set(stats['attempt-count'])
  finally:
    ts_mon.flush()

  return 0