Commit 0646dd9e authored by Quinten Yearsley's avatar Quinten Yearsley Committed by Commit Bot

Allow GitCL.trigger_try_jobs to take a frozenset

Bug: 658880
Change-Id: I8f03010037dbc45daa9165e9e5ae8c47ade889d0
Reviewed-on: https://chromium-review.googlesource.com/726970Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510158}
parent d56d158d
...@@ -51,13 +51,14 @@ class GitCL(object): ...@@ -51,13 +51,14 @@ class GitCL(object):
return self._host.executive.run_command(command, cwd=self._cwd) return self._host.executive.run_command(command, cwd=self._cwd)
def trigger_try_jobs(self, builders): def trigger_try_jobs(self, builders):
# This method assumes the bots to be triggered are Blink try bots, # Hack: This method assumes the bots to be triggered are Blink try bots,
# which are all on the master tryserver.blink except android_blink_rel. # which are all on the master tryserver.blink, except android_blink_rel.
if 'android_blink_rel' in builders: if 'android_blink_rel' in builders:
self.run(['try', '-b', 'android_blink_rel']) self.run(['try', '-b', 'android_blink_rel'])
builders.remove('android_blink_rel') builders = builders - {'android_blink_rel'}
# TODO(qyearsley): Stop explicitly adding the master name when # The master name has to be explicitly added for some builders since
# git cl try can get the master name; see http://crbug.com/700523. # git cl try doesn't necessarily have a reliable map of builder names
# to masters. See https://crbug.com/700552.
command = ['try', '-m', 'tryserver.blink'] command = ['try', '-m', 'tryserver.blink']
for builder in sorted(builders): for builder in sorted(builders):
command.extend(['-b', builder]) command.extend(['-b', builder])
......
...@@ -37,6 +37,43 @@ class GitCLTest(unittest.TestCase): ...@@ -37,6 +37,43 @@ class GitCLTest(unittest.TestCase):
git_cl.run(['issue']) git_cl.run(['issue'])
self.assertEqual(host.executive.calls, [['git', 'cl', 'issue']]) self.assertEqual(host.executive.calls, [['git', 'cl', 'issue']])
def test_trigger_try_jobs_with_frozenset(self):
# The trigger_try_jobs method may be called with an immutable set.
# It has special logic which assumes most builders to trigger are
# on the master tryserver.blink.
host = MockHost()
git_cl = GitCL(host, auth_refresh_token_json='token.json')
git_cl.trigger_try_jobs(frozenset(['builder-a', 'builder-b']))
self.assertEqual(host.executive.calls, [
[
'git', 'cl', 'try',
'-m', 'tryserver.blink',
'-b', 'builder-a', '-b', 'builder-b',
'--auth-refresh-token-json', 'token.json'
],
])
def test_trigger_try_jobs_with_android_blink_rel(self):
# The trigger_try_jobs method may be called with an immutable set.
# It has special logic which assumes most builders to trigger are
# on the master tryserver.blink.
host = MockHost()
git_cl = GitCL(host, auth_refresh_token_json='token.json')
git_cl.trigger_try_jobs(frozenset(['builder-a', 'android_blink_rel']))
self.assertEqual(host.executive.calls, [
[
'git', 'cl', 'try',
'-b', 'android_blink_rel',
'--auth-refresh-token-json', 'token.json'
],
[
'git', 'cl', 'try',
'-m', 'tryserver.blink',
'-b', 'builder-a',
'--auth-refresh-token-json', 'token.json'
],
])
def test_get_issue_number(self): def test_get_issue_number(self):
host = MockHost() host = MockHost()
host.executive = MockExecutive(output='Issue number: 12345 (http://crrev.com/12345)') host.executive = MockExecutive(output='Issue number: 12345 (http://crrev.com/12345)')
......
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