Beispiel #1
0
 def testCountRecentCommitsNoNext(self):
     self.mock(
         GitilesRepository, 'GetNChangeLogs',
         self._GenerateGetNChangeLogsMock(timedelta(minutes=1),
                                          next_rev=None))
     self.mock(time_util, 'GetUTCNow', lambda: SOME_TIME)
     self.assertTrue(10 <= git.CountRecentCommits('url'))
Beispiel #2
0
def _LowRepoActivity():
    """Returns true if 3 or fewer commits have landed in the last hour.

  The reasoning is: a typical builder can do about 3 full builds in an hour, so
  in periods where more than 3 commits are landed per hour, it's more likely
  that conitnuous builds will include multiple changes per build and any compile
  failure will necessitate a Findit compile failure analysis and tryjob to find
  a culprit.
  """
    repo_activity = git.CountRecentCommits(
        constants.CHROMIUM_GIT_REPOSITORY_URL)
    return repo_activity <= LOW_COMMITS_PER_HOUR
Beispiel #3
0
 def testCountRecentCommitsNoLogs(self):
     self.mock(GitilesRepository, 'GetNChangeLogs', lambda self, r, n:
               ([], None))
     self.mock(time_util, 'GetUTCNow', lambda: SOME_TIME)
     self.assertEqual(0, git.CountRecentCommits('url'))
Beispiel #4
0
 def testCountRecentCommitsNormal(self):
     self.mock(GitilesRepository, 'GetNChangeLogs',
               self._GenerateGetNChangeLogsMock(timedelta(minutes=10)))
     self.mock(time_util, 'GetUTCNow', lambda: SOME_TIME)
     self.assertEqual(7, git.CountRecentCommits('url'))