示例#1
0
    def testAutoRevertOff(self, mock_fn, _):
        repo_name = 'chromium'
        revision = 'rev1'

        cl_info = ClInfo(self.review_server_host, self.review_change_id)
        cl_info.auto_revert_off = True
        cl_info.commits.append(
            Commit('20001', 'rev1', [], datetime(2017, 2, 1, 0, 0, 0)))
        mock_fn.return_value = cl_info

        culprit = WfSuspectedCL.Create(repo_name, revision, 123)
        culprit.put()

        revert_status, revert, reason = gerrit.RevertCulprit(
            culprit.key.urlsafe(), 'm/b/1', failure_type.COMPILE, 'compile',
            self.codereview_info)

        self.assertEquals(services_constants.SKIPPED, revert_status)
        self.assertEquals(services_constants.AUTO_REVERT_OFF, reason)
        self.assertIsNone(revert)
示例#2
0
    def testAutoRevertOff(self, mock_fn, _):
        repo_name = 'chromium'
        revision = 'rev1'

        cl_info = ClInfo(self.review_server_host, self.review_change_id)
        cl_info.auto_revert_off = True
        cl_info.commits.append(
            Commit('20001', 'rev1', datetime(2017, 2, 1, 0, 0, 0)))
        mock_fn.return_value = cl_info

        culprit = WfSuspectedCL.Create(repo_name, revision, 123)
        culprit.put()
        pipeline = CreateRevertCLPipeline('m', 'b', 123, repo_name, revision)
        revert_status = pipeline.run('m', 'b', 123, repo_name, revision)

        self.assertEquals(revert_status, create_revert_cl_pipeline.SKIPPED)

        culprit = WfSuspectedCL.Get(repo_name, revision)
        self.assertEqual(culprit.revert_status, status.SKIPPED)
        self.assertIsNone(culprit.revert_cl)
        self.assertEqual(culprit.skip_revert_reason,
                         create_revert_cl_pipeline.AUTO_REVERT_OFF)