From 85da74b6714a2a1df41d27b2e37ceb22c803f206 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Thu, 27 Oct 2011 17:13:30 +0000 Subject: [PATCH] Temporarily disable CheckRietveldTryJobExecution() while the Rietveld API is being upgraded BUG= TEST= Review URL: http://codereview.chromium.org/8353039 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@107590 0039d316-1c4b-4281-b951-d872f2087c98 --- presubmit_canned_checks.py | 46 ++----------------------------------- tests/presubmit_unittest.py | 42 --------------------------------- 2 files changed, 2 insertions(+), 86 deletions(-) diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index 6d6de09d8..6f7c4bafd 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -678,50 +678,8 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None): # TODO(dpranke): Get the host_url from the input_api instead def CheckRietveldTryJobExecution(input_api, output_api, host_url, platforms, owner): - if not input_api.is_committing: - return [] - if not input_api.change.issue or not input_api.change.patchset: - return [] - url = '%s/%d/get_build_results/%d' % ( - host_url, input_api.change.issue, input_api.change.patchset) - try: - connection = input_api.urllib2.urlopen(url) - # platform|status|url - values = [item.split('|', 2) for item in connection.read().splitlines()] - connection.close() - except input_api.urllib2.HTTPError, e: - if e.code == 404: - # Fallback to no try job. - return [output_api.PresubmitPromptWarning( - 'You should try the patch first.')] - else: - # Another HTTP error happened, warn the user. - return [output_api.PresubmitPromptWarning( - 'Got %s while looking for try job status.' % str(e))] - - if not values: - # It returned an empty list. Probably a private review. - return [] - # Reformat as an dict of platform: [status, url] - values = dict([[v[0], [v[1], v[2]]] for v in values if len(v) == 3]) - if not values: - # It returned useless data. - return [output_api.PresubmitNotifyResult('Failed to parse try job results')] - - for platform in platforms: - values.setdefault(platform, ['not started', '']) - message = None - non_success = [k.upper() for k, v in values.iteritems() if v[0] != 'success'] - if 'failure' in [v[0] for v in values.itervalues()]: - message = 'Try job failures on %s!\n' % ', '.join(non_success) - elif non_success: - message = ('Unfinished (or not even started) try jobs on ' - '%s.\n') % ', '.join(non_success) - if message: - message += ( - 'Is try server wrong or broken? Please notify %s. ' - 'Thanks.\n' % owner) - return [output_api.PresubmitPromptWarning(message=message)] + # Temporarily 'fix' the check while the Rietveld API is being upgraded to + # something sensible. return [] diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index 0c066d17d..8c2503823 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -2000,48 +2000,6 @@ class CannedChecksUnittest(PresubmitTestsBase): input_api, presubmit.OutputApi, ['test_module']) self.assertEquals(len(results), 0) - def testCheckRietveldTryJobExecutionBad(self): - change = self.mox.CreateMock(presubmit.SvnChange) - change.scm = 'svn' - change.issue = 2 - change.patchset = 5 - input_api = self.MockInputApi(change, True) - connection = self.mox.CreateMockAnything() - input_api.urllib2.urlopen('uurl/2/get_build_results/5').AndReturn( - connection) - connection.read().AndReturn('foo') - connection.close() - self.mox.ReplayAll() - - results = presubmit_canned_checks.CheckRietveldTryJobExecution( - input_api, presubmit.OutputApi, 'uurl', ('mac', 'linux'), 'georges') - self.assertEquals(len(results), 1) - self.assertEquals(results[0].__class__, - presubmit.OutputApi.PresubmitNotifyResult) - - def testCheckRietveldTryJobExecutionGood(self): - change = self.mox.CreateMock(presubmit.SvnChange) - change.scm = 'svn' - change.issue = 2 - change.patchset = 5 - input_api = self.MockInputApi(change, True) - connection = self.mox.CreateMockAnything() - input_api.urllib2.urlopen('uurl/2/get_build_results/5').AndReturn( - connection) - connection.read().AndReturn("""amiga|Foo|blah -linux|failure|bleh -mac|success|blew -""") - connection.close() - self.mox.ReplayAll() - - results = presubmit_canned_checks.CheckRietveldTryJobExecution( - input_api, presubmit.OutputApi, 'uurl', ('mac', 'linux', 'amiga'), - 'georges') - self.assertEquals(len(results), 1) - self.assertEquals(results[0].__class__, - presubmit.OutputApi.PresubmitPromptWarning) - def testCheckBuildbotPendingBuildsBad(self): input_api = self.MockInputApi(None, True) connection = self.mox.CreateMockAnything()