| 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 mock | 5 import mock |
| 6 | 6 |
| 7 from common.waterfall import buildbucket_client | 7 from common.waterfall import buildbucket_client |
| 8 from common.waterfall import failure_type | 8 from common.waterfall import failure_type |
| 9 from model.wf_try_job import WfTryJob | |
| 10 from model.wf_try_job_data import WfTryJobData | |
| 11 from waterfall import schedule_try_job_pipeline | 9 from waterfall import schedule_try_job_pipeline |
| 12 from waterfall.schedule_try_job_pipeline import ScheduleTryJobPipeline | 10 from waterfall.schedule_try_job_pipeline import ScheduleTryJobPipeline |
| 13 from waterfall.test import wf_testcase | 11 from waterfall.test import wf_testcase |
| 14 | 12 |
| 15 | 13 |
| 16 class ScheduleTryjobPipelineTest(wf_testcase.WaterfallTestCase): | 14 class ScheduleTryjobPipelineTest(wf_testcase.WaterfallTestCase): |
| 17 | 15 |
| 18 def testGetBuildPropertiesWithSuspectedRevision(self): | 16 def testGetBuildPropertiesWithSuspectedRevision(self): |
| 19 master_name = 'm' | 17 master_name = 'm' |
| 20 builder_name = 'b' | 18 builder_name = 'b' |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 67 } |
| 70 } | 68 } |
| 71 results = [(None, buildbucket_client.BuildbucketBuild(response['build']))] | 69 results = [(None, buildbucket_client.BuildbucketBuild(response['build']))] |
| 72 mock_module.TriggerTryJobs.return_value = results | 70 mock_module.TriggerTryJobs.return_value = results |
| 73 | 71 |
| 74 try_job_pipeline = ScheduleTryJobPipeline() | 72 try_job_pipeline = ScheduleTryJobPipeline() |
| 75 build_id = try_job_pipeline._TriggerTryJob( | 73 build_id = try_job_pipeline._TriggerTryJob( |
| 76 master_name, builder_name, {}, []) | 74 master_name, builder_name, {}, []) |
| 77 | 75 |
| 78 self.assertEqual(build_id, '1') | 76 self.assertEqual(build_id, '1') |
| 79 | |
| 80 | |
| 81 def testCreateTryJobData(self): | |
| 82 build_id = 1 | |
| 83 master_name = 'm' | |
| 84 builder_name = 'b' | |
| 85 build_number = 1 | |
| 86 try_job_type = failure_type.GetDescriptionForFailureType(failure_type.TEST) | |
| 87 | |
| 88 ScheduleTryJobPipeline()._CreateTryJobData( | |
| 89 build_id, master_name, builder_name, build_number, try_job_type, | |
| 90 False, False) | |
| 91 | |
| 92 data = WfTryJobData.Get(build_id) | |
| 93 | |
| 94 self.assertIsNotNone(data) | |
| 95 self.assertEqual(data.master_name, master_name) | |
| 96 self.assertEqual(data.builder_name, builder_name) | |
| 97 self.assertEqual(data.build_number, build_number) | |
| 98 self.assertEqual(data.try_job_type, try_job_type) | |
| 99 self.assertFalse(data.has_compile_targets) | |
| 100 self.assertFalse(data.has_heuristic_results) | |
| OLD | NEW |