Commit 7837307d authored by Stephen Martinis's avatar Stephen Martinis Committed by LUCI CQ

Delete CheckBuildbotPendingBuilds

This check has been disabled basically everywhere since about 2013. It
should be safe to remove this; there will be warnings when trying to
skip it, but it shouldn't fail any builds.

Recipe-Nontrivial-Roll: build
Bug: 1194216
Change-Id: I84878f9e46543ae71f7e4e057b99d15a034e0d0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2794799
Commit-Queue: Stephen Martinis <martiniss@chromium.org>
Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@google.com>
Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
parent 9eed4238
......@@ -989,39 +989,6 @@ def RunPylint(input_api, *args, **kwargs):
return input_api.RunTests(GetPylint(input_api, *args, **kwargs), False)
def CheckBuildbotPendingBuilds(input_api, output_api, url, max_pendings,
ignored):
try:
connection = input_api.urllib_request.urlopen(url)
raw_data = connection.read()
connection.close()
except IOError:
return [output_api.PresubmitNotifyResult('%s is not accessible' % url)]
try:
data = input_api.json.loads(raw_data)
except ValueError:
return [output_api.PresubmitNotifyResult('Received malformed json while '
'looking up buildbot status')]
out = []
for (builder_name, builder) in data.items():
if builder_name in ignored:
continue
if builder.get('state', '') == 'offline':
continue
pending_builds_len = len(builder.get('pending_builds', []))
if pending_builds_len > max_pendings:
out.append('%s has %d build(s) pending' %
(builder_name, pending_builds_len))
if out:
return [output_api.PresubmitPromptWarning(
'Build(s) pending. It is suggested to wait that no more than %d '
'builds are pending.' % max_pendings,
long_text='\n'.join(out))]
return []
def CheckDirMetadataFormat(input_api, output_api, dirmd_bin=None):
# TODO(crbug.com/1102997): Remove OWNERS once DIR_METADATA migration is
# complete.
......
......@@ -110,7 +110,6 @@ class PresubmitApi(recipe_api.RecipeApi):
'--commit',
'--verbose', '--verbose',
'--skip_canned', 'CheckTreeIsOpen',
'--skip_canned', 'CheckBuildbotPendingBuilds',
'--upstream', upstream, # '' if not in bot_update mode.
])
......
......@@ -2552,31 +2552,6 @@ the current line as well!
self.checkstdout('')
def testCheckBuildbotPendingBuildsBad(self):
input_api = self.MockInputApi(None, True)
input_api.urllib_request.urlopen().read.return_value = 'foo'
results = presubmit_canned_checks.CheckBuildbotPendingBuilds(
input_api, presubmit.OutputApi, 'uurl', 2, ('foo'))
self.assertEqual(len(results), 1)
self.assertEqual(results[0].__class__,
presubmit.OutputApi.PresubmitNotifyResult)
def testCheckBuildbotPendingBuildsGood(self):
input_api = self.MockInputApi(None, True)
input_api.urllib_request.urlopen().read.return_value = """
{
'b1': { 'pending_builds': [0, 1, 2, 3, 4, 5, 6, 7] },
'foo': { 'pending_builds': [0, 1, 2, 3, 4, 5, 6, 7] },
'b2': { 'pending_builds': [0] }
}"""
results = presubmit_canned_checks.CheckBuildbotPendingBuilds(
input_api, presubmit.OutputApi, 'uurl', 2, ('foo'))
self.assertEqual(len(results), 1)
self.assertEqual(results[0].__class__,
presubmit.OutputApi.PresubmitNotifyResult)
def GetInputApiWithFiles(self, files):
change = mock.MagicMock(presubmit.Change)
change.AffectedFiles = lambda *a, **kw: (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment