Chromium Code Reviews| Index: appengine/findit/waterfall/test/try_job_util_test.py |
| diff --git a/appengine/findit/waterfall/test/try_job_util_test.py b/appengine/findit/waterfall/test/try_job_util_test.py |
| index df855b3d4a30454e116d00c264ab8599fc936249..be72a0775c7f4904b9b2e69499108dba2060a872 100644 |
| --- a/appengine/findit/waterfall/test/try_job_util_test.py |
| +++ b/appengine/findit/waterfall/test/try_job_util_test.py |
| @@ -70,12 +70,6 @@ class TryJobUtilTest(wf_testcase.WaterfallTestCase): |
| 'SwarmingTasksToTryJobPipeline', _MockRootPipeline) |
| _MockRootPipeline.STARTED = False |
| - def _MockShouldBailOutForOutdatedBuild(*_): |
| - return False |
| - self.mock( |
| - try_job_util, '_ShouldBailOutForOutdatedBuild', |
| - _MockShouldBailOutForOutdatedBuild) |
| - |
| failure_result_map = try_job_util.ScheduleTryJobIfNeeded( |
| failure_info, None, None) |
| @@ -108,8 +102,8 @@ class TryJobUtilTest(wf_testcase.WaterfallTestCase): |
| self.assertEqual({}, failure_result_map) |
| def testBailOutForTryJobWithOutdatedTimestamp(self): |
| - master_name = 'master3' |
| - builder_name = 'builder3' |
| + master_name = 'master1' |
| + builder_name = 'builder1' |
| build_number = 223 |
| failure_info = { |
| 'master_name': master_name, |
| @@ -124,6 +118,11 @@ class TryJobUtilTest(wf_testcase.WaterfallTestCase): |
| }, |
| } |
| + yesterday = datetime.utcnow() - timedelta(days=1) |
| + build = WfBuild.Create(master_name, builder_name, build_number) |
| + build.start_time = yesterday |
| + build.put() |
| + |
| self.mock( |
| try_job_util.swarming_tasks_to_try_job_pipeline, |
| 'SwarmingTasksToTryJobPipeline', _MockRootPipeline) |
| @@ -131,16 +130,57 @@ class TryJobUtilTest(wf_testcase.WaterfallTestCase): |
| def _MockShouldBailOutForOutdatedBuild(*_): |
| return True |
| + |
| self.mock( |
| try_job_util, '_ShouldBailOutForOutdatedBuild', |
| _MockShouldBailOutForOutdatedBuild) |
| failure_result_map = try_job_util.ScheduleTryJobIfNeeded( |
| - failure_info, None, None) |
| + failure_info, None, None, False) |
| self.assertFalse(_MockRootPipeline.STARTED) |
| self.assertEqual({}, failure_result_map) |
| + def testBailOutForTryJobWithOutdatedTimestampForce(self): |
|
chanli
2016/06/01 21:01:59
Naming nit: because of 'force' the try job doesn't
lijeffrey
2016/06/02 05:36:06
Done.
|
| + master_name = 'm' |
| + builder_name = 'b' |
| + build_number = 223 |
| + failure_info = { |
| + 'master_name': master_name, |
| + 'builder_name': builder_name, |
| + 'build_number': build_number, |
| + 'failed_steps': { |
| + 'compile': { |
| + 'current_failure': 223, |
| + 'first_failure': 223, |
| + 'last_pass': 222 |
| + } |
| + }, |
| + 'builds': { |
| + '222': { |
| + 'blame_list': ['222-1'], |
| + 'chromium_revision': '222-1' |
| + }, |
| + '223': { |
| + 'blame_list': ['223-1', '223-2', '223-3'], |
| + 'chromium_revision': '223-3' |
| + } |
| + }, |
| + 'failure_type': failure_type.COMPILE |
| + } |
| + |
| + self.mock( |
| + try_job_util.swarming_tasks_to_try_job_pipeline, |
| + 'SwarmingTasksToTryJobPipeline', _MockRootPipeline) |
| + _MockRootPipeline.STARTED = False |
| + |
| + try_job_util.ScheduleTryJobIfNeeded(failure_info, None, None, True) |
| + |
| + try_job = WfTryJob.Get(master_name, builder_name, build_number) |
| + |
| + self.assertTrue(_MockRootPipeline.STARTED) |
| + self.assertIsNotNone(try_job) |
| + |
| def testNotNeedANewTryJobIfNotFirstTimeFailure(self): |
| master_name = 'm' |
| builder_name = 'b' |
| @@ -184,6 +224,7 @@ class TryJobUtilTest(wf_testcase.WaterfallTestCase): |
| def _MockShouldBailOutForOutdatedBuild(*_): |
| return False |
| + |
| self.mock( |
| try_job_util, '_ShouldBailOutForOutdatedBuild', |
| _MockShouldBailOutForOutdatedBuild) |
| @@ -425,6 +466,7 @@ class TryJobUtilTest(wf_testcase.WaterfallTestCase): |
| def _MockShouldBailOutForOutdatedBuild(*_): |
| return False |
| + |
| self.mock( |
| try_job_util, '_ShouldBailOutForOutdatedBuild', |
| _MockShouldBailOutForOutdatedBuild) |