| 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 from datetime import datetime | 5 from datetime import datetime |
| 6 from datetime import timedelta | 6 from datetime import timedelta |
| 7 | 7 |
| 8 from common.waterfall import failure_type | 8 from common.waterfall import failure_type |
| 9 from model import analysis_status | 9 from model import analysis_status |
| 10 from model.wf_build import WfBuild | 10 from model.wf_build import WfBuild |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 def testNeedANewTryJobIfTestFailureSwarming(self): | 361 def testNeedANewTryJobIfTestFailureSwarming(self): |
| 362 master_name = 'm' | 362 master_name = 'm' |
| 363 builder_name = 'b' | 363 builder_name = 'b' |
| 364 build_number = 223 | 364 build_number = 223 |
| 365 failed_steps = { | 365 failed_steps = { |
| 366 'a': { | 366 'a': { |
| 367 'current_failure': 223, | 367 'current_failure': 223, |
| 368 'first_failure': 222, | 368 'first_failure': 222, |
| 369 'last_pass': 221, | 369 'last_pass': 221, |
| 370 'tests': { | 370 'tests': { |
| 371 'a.t1': { | 371 'a.PRE_t1': { |
| 372 'current_failure': 223, | 372 'current_failure': 223, |
| 373 'first_failure': 223, | 373 'first_failure': 223, |
| 374 'last_pass': 221 | 374 'last_pass': 221, |
| 375 'base_test_name': 'a.t1' |
| 375 }, | 376 }, |
| 376 'a.t2': { | 377 'a.t2': { |
| 377 'current_failure': 223, | 378 'current_failure': 223, |
| 378 'first_failure': 222, | 379 'first_failure': 222, |
| 379 'last_pass': 221 | 380 'last_pass': 221 |
| 380 }, | 381 }, |
| 381 'a.t3': { | 382 'a.t3': { |
| 382 'current_failure': 223, | 383 'current_failure': 223, |
| 383 'first_failure': 223, | 384 'first_failure': 223, |
| 384 'last_pass': 222 | 385 'last_pass': 222 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 404 } | 405 } |
| 405 } | 406 } |
| 406 | 407 |
| 407 failure_result_map = {} | 408 failure_result_map = {} |
| 408 need_try_job, last_pass, try_job_type, targeted_tests = ( | 409 need_try_job, last_pass, try_job_type, targeted_tests = ( |
| 409 try_job_util._NeedANewTryJob(master_name, builder_name, build_number, | 410 try_job_util._NeedANewTryJob(master_name, builder_name, build_number, |
| 410 failed_steps, failure_result_map)) | 411 failed_steps, failure_result_map)) |
| 411 | 412 |
| 412 expected_failure_result_map = { | 413 expected_failure_result_map = { |
| 413 'a': { | 414 'a': { |
| 414 'a.t1': 'm/b/223', | 415 'a.PRE_t1': 'm/b/223', |
| 415 'a.t2': 'm/b/222', | 416 'a.t2': 'm/b/222', |
| 416 'a.t3': 'm/b/223' | 417 'a.t3': 'm/b/223' |
| 417 }, | 418 }, |
| 418 'b': { | 419 'b': { |
| 419 'b.t1': 'm/b/222', | 420 'b.t1': 'm/b/222', |
| 420 'b.t2': 'm/b/222' | 421 'b.t2': 'm/b/222' |
| 421 }, | 422 }, |
| 422 } | 423 } |
| 423 | 424 |
| 424 expected_targeted_tests = { | 425 expected_targeted_tests = { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 try_job_util._GetSuspectsFromHeuristicResult(heuristic_result)) | 582 try_job_util._GetSuspectsFromHeuristicResult(heuristic_result)) |
| 582 | 583 |
| 583 def testShouldBailOutforOutdatedBuild(self): | 584 def testShouldBailOutforOutdatedBuild(self): |
| 584 yesterday = datetime.utcnow() - timedelta(days=1) | 585 yesterday = datetime.utcnow() - timedelta(days=1) |
| 585 build = WfBuild.Create('m', 'b', 1) | 586 build = WfBuild.Create('m', 'b', 1) |
| 586 build.start_time = yesterday | 587 build.start_time = yesterday |
| 587 self.assertTrue(try_job_util._ShouldBailOutForOutdatedBuild(build)) | 588 self.assertTrue(try_job_util._ShouldBailOutForOutdatedBuild(build)) |
| 588 | 589 |
| 589 build.start_time = yesterday + timedelta(hours=1) | 590 build.start_time = yesterday + timedelta(hours=1) |
| 590 self.assertFalse(try_job_util._ShouldBailOutForOutdatedBuild(build)) | 591 self.assertFalse(try_job_util._ShouldBailOutForOutdatedBuild(build)) |
| OLD | NEW |