Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: appengine/cr-buildbucket/swarming/test/swarming_test.py

Issue 2044253002: swarmbucket: add support for blamelist (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: fix coverage Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/cr-buildbucket/swarming/swarming.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import base64 5 import base64
6 import contextlib 6 import contextlib
7 import datetime 7 import datetime
8 import json 8 import json
9 9
10 from components import auth 10 from components import auth
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 build = model.Build( 139 build = model.Build(
140 bucket='bucket', 140 bucket='bucket',
141 tags=['builder:builder'], 141 tags=['builder:builder'],
142 parameters={ 142 parameters={
143 'builder_name': 'builder', 143 'builder_name': 'builder',
144 'swarming': { 144 'swarming': {
145 'recipe': {'revision': 'badcoffee'}, 145 'recipe': {'revision': 'badcoffee'},
146 }, 146 },
147 'properties': { 147 'properties': {
148 'a': 'b', 148 'a': 'b',
149 } 149 },
150 'changes': [{
151 'author': {'email': 'bob@example.com'},
152 }]
150 }, 153 },
151 ) 154 )
152 155
153 self.mock(net, 'json_request_async', mock.Mock(return_value=futuristic({ 156 self.mock(net, 'json_request_async', mock.Mock(return_value=futuristic({
154 'task_id': 'deadbeef', 157 'task_id': 'deadbeef',
155 'request': { 158 'request': {
156 'properties': { 159 'properties': {
157 'dimensions': [ 160 'dimensions': [
158 {'key': 'cores', 'value': '8'}, 161 {'key': 'cores', 'value': '8'},
159 {'key': 'os', 'value': 'Linux'}, 162 {'key': 'os', 'value': 'Linux'},
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 'namespace': 'default-gzip', 205 'namespace': 'default-gzip',
203 'isolated': 'cbacbdcbabcd' 206 'isolated': 'cbacbdcbabcd'
204 }, 207 },
205 'extra_args': [ 208 'extra_args': [
206 'cook', 209 'cook',
207 '-repository', 'https://example.com/repo', 210 '-repository', 'https://example.com/repo',
208 '-revision', 'badcoffee', 211 '-revision', 'badcoffee',
209 '-recipe', 'recipe', 212 '-recipe', 'recipe',
210 '-properties', json.dumps({ 213 '-properties', json.dumps({
211 'a': 'b', 214 'a': 'b',
215 'blamelist': ['bob@example.com'],
212 'buildername': 'builder', 216 'buildername': 'builder',
213 'predefined-property': 'x', 217 'predefined-property': 'x',
214 }, sort_keys=True) 218 }, sort_keys=True)
215 ], 219 ],
216 'dimensions': sorted([ 220 'dimensions': sorted([
217 {'key': 'cores', 'value': '8'}, 221 {'key': 'cores', 'value': '8'},
218 {'key': 'os', 'value': 'Linux'}, 222 {'key': 'os', 'value': 'Linux'},
219 {'key': 'pool', 'value': 'Chrome'}, 223 {'key': 'pool', 'value': 'Chrome'},
220 ]), 224 ]),
221 }, 225 },
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 self.assertEqual(build.status, model.BuildStatus.COMPLETED) 575 self.assertEqual(build.status, model.BuildStatus.COMPLETED)
572 self.assertEqual(build.result, model.BuildResult.FAILURE) 576 self.assertEqual(build.result, model.BuildResult.FAILURE)
573 self.assertEqual(build.failure_reason, model.FailureReason.INFRA_FAILURE) 577 self.assertEqual(build.failure_reason, model.FailureReason.INFRA_FAILURE)
574 self.assertIsNotNone(build.result_details) 578 self.assertIsNotNone(build.result_details)
575 self.assertIsNone(build.lease_key) 579 self.assertIsNone(build.lease_key)
576 self.assertIsNotNone(build.complete_time) 580 self.assertIsNotNone(build.complete_time)
577 581
578 582
579 def b64json(data): 583 def b64json(data):
580 return base64.b64encode(json.dumps(data)) 584 return base64.b64encode(json.dumps(data))
OLDNEW
« no previous file with comments | « appengine/cr-buildbucket/swarming/swarming.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698