OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from pipeline_utils.appengine_third_party_pipeline_src_pipeline import handlers |
| 6 from testing_utils import testing |
| 7 |
| 8 from model.step import Step |
| 9 from waterfall import buildbot |
| 10 from waterfall import extractors |
| 11 from waterfall.extract_signal_pipeline import ExtractSignalPipeline |
| 12 |
| 13 |
| 14 class ExtractSignalPipelineTest(testing.AppengineTestCase): |
| 15 app_module = handlers._APP |
| 16 |
| 17 ABC_TEST_FAILURE_LOG = """ |
| 18 ... |
| 19 ../../content/common/gpu/media/v4l2_video_encode_accelerator.cc:306:12: |
| 20 ... |
| 21 """ |
| 22 |
| 23 FAILURE_SIGNALS = { |
| 24 "abc_test": { |
| 25 "files": { |
| 26 "content/common/gpu/media/v4l2_video_encode_accelerator.cc": [306] |
| 27 }, |
| 28 "keywords": {}, |
| 29 "tests": [] |
| 30 } |
| 31 } |
| 32 |
| 33 FAILURE_INFO = { |
| 34 'master_name': 'm', |
| 35 'builder_name': 'b', |
| 36 'build_number': 123, |
| 37 'failed_steps': { |
| 38 'abc_test': { |
| 39 'last_pass': 122, |
| 40 'current_failure': 123, |
| 41 'first_failure': 123, |
| 42 } |
| 43 } |
| 44 } |
| 45 |
| 46 |
| 47 |
| 48 def testStepStdioLogAlreadyDownloaded(self): |
| 49 master_name = 'm' |
| 50 builder_name = 'b' |
| 51 build_number = 123 |
| 52 step_name = 'abc_test' |
| 53 step = Step.CreateStep(master_name, builder_name, build_number, step_name) |
| 54 step.log_data = self.ABC_TEST_FAILURE_LOG |
| 55 step.put() |
| 56 |
| 57 step_log_url = buildbot.CreateStdioLogUrl( |
| 58 master_name, builder_name, build_number, step_name) |
| 59 with self.mock_urlfetch() as urlfetch: |
| 60 urlfetch.register_handler(step_log_url, 'If used, test should fail!') |
| 61 |
| 62 pipeline = ExtractSignalPipeline(self.FAILURE_INFO) |
| 63 signals = pipeline.run(self.FAILURE_INFO) |
| 64 |
| 65 self.assertEqual(self.FAILURE_SIGNALS, signals) |
| 66 |
| 67 def testStepStdioLogNotDownloadedYet(self): |
| 68 master_name = 'm' |
| 69 builder_name = 'b' |
| 70 build_number = 123 |
| 71 step_name = 'abc_test' |
| 72 |
| 73 step_log_url = buildbot.CreateStdioLogUrl( |
| 74 master_name, builder_name, build_number, step_name) |
| 75 with self.mock_urlfetch() as urlfetch: |
| 76 urlfetch.register_handler(step_log_url, self.ABC_TEST_FAILURE_LOG) |
| 77 |
| 78 pipeline = ExtractSignalPipeline(self.FAILURE_INFO) |
| 79 pipeline.start() |
| 80 self.execute_queued_tasks() |
| 81 |
| 82 step = Step.CreateStep(master_name, builder_name, build_number, step_name) |
| 83 self.assertIsNotNone(step) |
OLD | NEW |