| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 33 class SwarmingTest(testing.AppengineTestCase): | 33 class SwarmingTest(testing.AppengineTestCase): |
| 34 def setUp(self): | 34 def setUp(self): |
| 35 super(SwarmingTest, self).setUp() | 35 super(SwarmingTest, self).setUp() |
| 36 self.mock(utils, 'utcnow', lambda: datetime.datetime(2015, 11, 30)) | 36 self.mock(utils, 'utcnow', lambda: datetime.datetime(2015, 11, 30)) |
| 37 self.bucket_cfg = project_config_pb2.Bucket( | 37 self.bucket_cfg = project_config_pb2.Bucket( |
| 38 name='bucket', | 38 name='bucket', |
| 39 swarming=project_config_pb2.Swarming( | 39 swarming=project_config_pb2.Swarming( |
| 40 hostname='chromium-swarm.appspot.com', | 40 hostname='chromium-swarm.appspot.com', |
| 41 url_format='https://example.com/{swarming_hostname}/{task_id}', | 41 url_format='https://example.com/{swarming_hostname}/{task_id}', |
| 42 common_swarming_tags=['commontag:yes'], | 42 common_swarming_tags=['commontag:yes'], |
| 43 common_dimensions=['cores:8', 'pool:default'], | 43 common_dimensions=['cores:8', 'pool:default', 'cpu:x86-64'], |
| 44 common_recipe=project_config_pb2.Swarming.Recipe( | 44 common_recipe=project_config_pb2.Swarming.Recipe( |
| 45 repository='https://example.com/repo', | 45 repository='https://example.com/repo', |
| 46 name='recipe', | 46 name='recipe', |
| 47 ), | 47 ), |
| 48 builders=[ | 48 builders=[ |
| 49 project_config_pb2.Swarming.Builder( | 49 project_config_pb2.Swarming.Builder( |
| 50 name='builder', | 50 name='builder', |
| 51 swarming_tags=['buildertag:yes'], | 51 swarming_tags=['buildertag:yes'], |
| 52 dimensions=['os:Linux', 'pool:Chrome'], | 52 dimensions=['os:Linux', 'pool:Chrome', 'cpu:'], |
| 53 recipe=project_config_pb2.Swarming.Recipe( | 53 recipe=project_config_pb2.Swarming.Recipe( |
| 54 properties=['predefined-property:x'], | 54 properties=['predefined-property:x'], |
| 55 properties_j=['predefined-property-bool:true'], | 55 properties_j=['predefined-property-bool:true'], |
| 56 ), | 56 ), |
| 57 priority=108, | 57 priority=108, |
| 58 ), | 58 ), |
| 59 ], | 59 ], |
| 60 ), | 60 ), |
| 61 ) | 61 ) |
| 62 self.mock( | 62 self.mock( |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 self.assertEqual(build.status, model.BuildStatus.COMPLETED) | 619 self.assertEqual(build.status, model.BuildStatus.COMPLETED) |
| 620 self.assertEqual(build.result, model.BuildResult.FAILURE) | 620 self.assertEqual(build.result, model.BuildResult.FAILURE) |
| 621 self.assertEqual(build.failure_reason, model.FailureReason.INFRA_FAILURE) | 621 self.assertEqual(build.failure_reason, model.FailureReason.INFRA_FAILURE) |
| 622 self.assertIsNotNone(build.result_details) | 622 self.assertIsNotNone(build.result_details) |
| 623 self.assertIsNone(build.lease_key) | 623 self.assertIsNone(build.lease_key) |
| 624 self.assertIsNotNone(build.complete_time) | 624 self.assertIsNotNone(build.complete_time) |
| 625 | 625 |
| 626 | 626 |
| 627 def b64json(data): | 627 def b64json(data): |
| 628 return base64.b64encode(json.dumps(data)) | 628 return base64.b64encode(json.dumps(data)) |
| OLD | NEW |