mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
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
This commit is contained in:
@@ -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 []
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user