| Index: tests/git_cl_test.py
|
| diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
|
| index 90647a713a04f1fe2930a6c784871ca75f615c55..54644766f9cc9f9327222a71b138826b434f71ab 100755
|
| --- a/tests/git_cl_test.py
|
| +++ b/tests/git_cl_test.py
|
| @@ -1929,7 +1929,64 @@ class TestGitCl(TestCase):
|
| '-p', 'key=val', '-p', 'json=[{"a":1}, null]']))
|
| self.assertRegexpMatches(
|
| git_cl.sys.stdout.getvalue(),
|
| - 'Tried jobs on:\nMaster: tryserver.chromium')
|
| + 'Tried jobs on:\nBucket: master.tryserver.chromium')
|
| +
|
| + def test_git_cl_try_buildbucket_bucket_flag(self):
|
| + self.mock(git_cl.Changelist, 'GetMostRecentPatchset', lambda _: 20001)
|
| + self.mock(git_cl.Changelist, 'GetIssueOwner', lambda _: 'owner@e.mail')
|
| + self.mock(git_cl.Changelist, 'GetIssueProject', lambda _: 'depot_tools')
|
| + self.mock(git_cl.uuid, 'uuid4', lambda: 'uuid4')
|
| + self.calls = [
|
| + ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
|
| + ((['git', 'config', 'branch.feature.rietveldissue'],), '123'),
|
| + ((['git', 'config', 'rietveld.autoupdate'],), CERR1),
|
| + ((['git', 'config', 'rietveld.server'],),
|
| + 'https://codereview.chromium.org'),
|
| + ((['git', 'config', 'branch.feature.rietveldserver'],), CERR1),
|
| + ((['git', 'config', 'branch.feature.rietveldpatchset'],), '20001'),
|
| + ]
|
| +
|
| + def _buildbucket_retry(*_, **kw):
|
| + # self.maxDiff = 10000
|
| + body = json.loads(kw['body'])
|
| + self.assertEqual(len(body['builds']), 1)
|
| + build = body['builds'][0]
|
| + params = json.loads(build.pop('parameters_json'))
|
| + self.assertEqual(params, {
|
| + u'builder_name': u'win',
|
| + u'changes': [{u'author': {u'email': u'owner@e.mail'},
|
| + u'revision': None}],
|
| + u'properties': {
|
| + u'category': u'git_cl_try',
|
| + u'issue': 123,
|
| + u'key': u'val',
|
| + u'json': [{u'a': 1}, None],
|
| + u'master': u'test.bucket',
|
| + u'patch_project': u'depot_tools',
|
| + u'patch_storage': u'rietveld',
|
| + u'patchset': 20001,
|
| + u'reason': u'feature', # This is a branch name, but why?
|
| + u'rietveld': u'https://codereview.chromium.org',
|
| + }
|
| + })
|
| + self.assertEqual(build, {
|
| + u'bucket': u'test.bucket',
|
| + u'client_operation_id': u'uuid4',
|
| + u'tags': [u'builder:win',
|
| + u'buildset:patch/rietveld/codereview.chromium.org/123/20001',
|
| + u'master:test.bucket',
|
| + u'user_agent:git_cl_try'],
|
| + })
|
| +
|
| + self.mock(git_cl, '_buildbucket_retry', _buildbucket_retry)
|
| +
|
| + self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
|
| + self.assertEqual(0, git_cl.main([
|
| + 'try', '-B', 'test.bucket', '-b', 'win',
|
| + '-p', 'key=val', '-p', 'json=[{"a":1}, null]']))
|
| + self.assertRegexpMatches(
|
| + git_cl.sys.stdout.getvalue(),
|
| + 'Tried jobs on:\nBucket: test.bucket')
|
|
|
| def _common_GerritCommitMsgHookCheck(self):
|
| self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
|
|
|