예제 #1
0
  def testCreateAndSubmitRevertOverLimit(self, under_limit, can_revert,
                                         revert_fn, commit_fn):
    build_key = 'mock_build_key'
    repo = 'chromium'
    rev = 'rev1'
    commit_position = 100
    pipeline_id = 'foo'

    culprit = FlakeCulprit.Create(repo, rev, commit_position)
    culprit.put()

    analysis = MasterFlakeAnalysis.Create('m', 'b', 123, 's', 't')
    analysis.culprit_urlsafe_key = culprit.key.urlsafe()
    analysis.put()

    pipeline_input = CreateAndSubmitRevertInput(
        analysis_urlsafe_key=analysis.key.urlsafe(), build_key=build_key)
    culprit_util.CreateAndSubmitRevert(pipeline_input, pipeline_id)

    under_limit.assert_called_once()
    can_revert.assert_not_called()
    revert_fn.assert_not_called()
    commit_fn.assert_not_called()

    self.assertFalse(analysis.has_created_autorevert)
    self.assertFalse(analysis.has_submitted_autorevert)
예제 #2
0
  def testCreateAndSubmitRevertCreateFailed(self, under_limit, can_revert,
                                            revert_fn, commit_fn):
    build_key = 'mock_build_key'
    repo = 'chromium'
    rev = 'rev1'
    commit_position = 100
    pipeline_id = 'foo'

    culprit = FlakeCulprit.Create(repo, rev, commit_position)
    culprit.put()

    analysis = MasterFlakeAnalysis.Create('m', 'b', 123, 's', 't')
    analysis.culprit_urlsafe_key = culprit.key.urlsafe()
    analysis.put()

    revert_expected = CreateRevertCLParameters(
        cl_key=culprit.key.urlsafe(),
        build_key=build_key,
        failure_type=failure_type.FLAKY_TEST)

    pipeline_input = CreateAndSubmitRevertInput(
        analysis_urlsafe_key=analysis.key.urlsafe(), build_key=build_key)
    culprit_util.CreateAndSubmitRevert(pipeline_input, pipeline_id)

    under_limit.assert_called_once()
    can_revert.assert_called_once_with(analysis)
    revert_fn.assert_called_once_with(revert_expected, pipeline_id)
    commit_fn.assert_not_called()

    self.assertFalse(analysis.has_created_autorevert)
    self.assertFalse(analysis.has_submitted_autorevert)
 def RunImpl(self, parameters):
   return culprit_util.CreateAndSubmitRevert(parameters, self.pipeline_id)