git cl upload --retry-failed: search back up to 5 patchsets.
Make it work the same way as "git cl try --retry-failed".
R=ehmaldonado
Change-Id: Id3a709dc40b6b6d068acbba0c610da254ced8ff3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1845478
Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
Auto-Submit: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 854762d..fbe979e 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -3354,41 +3354,48 @@
},
},
}
- mockFetchTryJobs.return_value = {
- '9000': {
- 'id': '9000',
- 'project': 'infra',
- 'bucket': 'luci.infra.try',
- 'created_by': 'user:someone@chromium.org',
- 'created_ts': '147200002222000',
- 'experimental': False,
- 'parameters_json': json.dumps({
- 'builder_name': 'red-bot',
- 'properties': {'category': 'cq'},
- }),
- 'status': 'COMPLETED',
- 'result': 'FAILURE',
- 'tags': ['user_agent:cq'],
- },
- 8000: {
- 'id': '8000',
- 'project': 'infra',
- 'bucket': 'luci.infra.try',
- 'created_by': 'user:someone@chromium.org',
- 'created_ts': '147200002222020',
- 'experimental': False,
- 'parameters_json': json.dumps({
- 'builder_name': 'green-bot',
- 'properties': {'category': 'cq'},
- }),
- 'status': 'COMPLETED',
- 'result': 'SUCCESS',
- 'tags': ['user_agent:cq'],
- },
- }
+ mockFetchTryJobs.side_effect = [
+ # Prior patchset - no builds.
+ {},
+ # Prior to prior patchset -- some builds.
+ {
+ '9000': {
+ 'id': '9000',
+ 'project': 'infra',
+ 'bucket': 'luci.infra.try',
+ 'created_by': 'user:someone@chromium.org',
+ 'created_ts': '147200002222000',
+ 'experimental': False,
+ 'parameters_json': json.dumps({
+ 'builder_name': 'red-bot',
+ 'properties': {'category': 'cq'},
+ }),
+ 'status': 'COMPLETED',
+ 'result': 'FAILURE',
+ 'tags': ['user_agent:cq'],
+ },
+ 8000: {
+ 'id': '8000',
+ 'project': 'infra',
+ 'bucket': 'luci.infra.try',
+ 'created_by': 'user:someone@chromium.org',
+ 'created_ts': '147200002222020',
+ 'experimental': False,
+ 'parameters_json': json.dumps({
+ 'builder_name': 'green-bot',
+ 'properties': {'category': 'cq'},
+ }),
+ 'status': 'COMPLETED',
+ 'result': 'SUCCESS',
+ 'tags': ['user_agent:cq'],
+ },
+ },
+ ]
self.assertEqual(0, git_cl.main(['upload', '--retry-failed']))
- mockFetchTryJobs.assert_called_with(
- mock.ANY, mock.ANY, 'cr-buildbucket.appspot.com', 7)
+ mockFetchTryJobs.assert_has_calls([
+ mock.call(mock.ANY, mock.ANY, 'cr-buildbucket.appspot.com', patchset=7),
+ mock.call(mock.ANY, mock.ANY, 'cr-buildbucket.appspot.com', patchset=6),
+ ])
buckets = {'infra/try': {'red-bot': []}}
mockTriggerTryJobs.assert_called_once_with(
mock.ANY, mock.ANY, buckets, mock.ANY, 8)