def testBailOutIfNotAFailedBuild(self): failure_info = { 'failed': False, } expected_change_logs = {} pipeline = PullChangelogPipeline() change_logs = pipeline.run(failure_info) self.assertEqual(expected_change_logs, change_logs)
def testBailOutIfNoValidChromiumRevision(self): failure_info = { 'failed': True, 'chromium_revision': None, } expected_change_logs = {} pipeline = PullChangelogPipeline() change_logs = pipeline.run(failure_info) self.assertEqual(expected_change_logs, change_logs)
def testBailOutIfInfraFailure(self): failure_info = { 'failed': True, 'chromium_revision': '00baf00ba', 'failure_type': failure_type.INFRA } expected_change_logs = {} pipeline = PullChangelogPipeline() change_logs = pipeline.run(failure_info) self.assertEqual(expected_change_logs, change_logs)
def testPullChangelogs(self): with self.mock_urlfetch() as urlfetch: urlfetch.register_handler(REV1_COMMIT_JSON_URL, REV1_COMMIT_LOG) failure_info = { 'failed': True, 'chromium_revision': 'rev1', 'builds': { '999': { 'blame_list': ['rev1'] } } } expected_change_logs = { 'rev1': { 'author_name': '*****@*****.**', 'message': 'git-svn-id: svn://svn.chromium.org/chromium/src@175976 blabla', 'committer_email': '*****@*****.**', 'commit_position': 175976, 'author_email': '*****@*****.**', 'touched_files': [{ 'new_path': 'added_file.js', 'change_type': 'add', 'old_path': '/dev/null' }], 'author_time': datetime.strptime('Wed Jun 11 19:35:32 2014', '%a %b %d %H:%M:%S %Y'), 'committer_time': datetime.strptime('Wed Jun 11 19:35:32 2014', '%a %b %d %H:%M:%S %Y'), 'commit_url': REV1_COMMIT_LOG_URL, 'code_review_url': None, 'committer_name': '*****@*****.**', 'revision': 'rev1' } } pipeline = PullChangelogPipeline() change_logs = pipeline.run(failure_info) self.assertEqual(expected_change_logs, change_logs)
def run(self, master_name, builder_name, build_number, build_completed, force): self._ResetAnalysis(master_name, builder_name, build_number) # The yield statements below return PipelineFutures, which allow subsequent # pipelines to refer to previous output values. # https://github.com/GoogleCloudPlatform/appengine-pipelines/wiki/Python # Heuristic Approach. failure_info = yield DetectFirstFailurePipeline( master_name, builder_name, build_number) change_logs = yield PullChangelogPipeline(failure_info) deps_info = yield ExtractDEPSInfoPipeline(failure_info, change_logs) signals = yield ExtractSignalPipeline(failure_info) heuristic_result = yield IdentifyCulpritPipeline( failure_info, change_logs, deps_info, signals, build_completed) # Try job approach. with pipeline.InOrder(): # Swarming rerun. # Triggers swarming tasks when first time test failure happens. # This pipeline will run before build completes. yield TriggerSwarmingTasksPipeline(master_name, builder_name, build_number, failure_info, force) # Checks if first time failures happen and starts a try job if yes. yield StartTryJobOnDemandPipeline(master_name, builder_name, build_number, failure_info, signals, heuristic_result, build_completed, force) # Trigger flake analysis on flaky tests, if any. yield TriggerFlakeAnalysesPipeline(master_name, builder_name, build_number)
def testPullChangelogs(self): with self.mock_urlfetch() as urlfetch: urlfetch.register_handler(REV1_COMMIT_JSON_URL, REV1_COMMIT_LOG) failure_info = { 'failed': True, 'chromium_revision': 'rev1', 'builds': { '999': { 'blame_list': ['rev1'] } } } expected_change_logs = { 'rev1': { 'author_name': '*****@*****.**', 'message': 'git-svn-id: svn://svn.chromium.org/chromium/src@175976 blabla', 'committer_email': '*****@*****.**', 'commit_position': 175976, 'author_email': '*****@*****.**', 'touched_files': [ { 'new_path': 'added_file.js', 'change_type': 'add', 'old_path': '/dev/null' } ], 'author_time': datetime.strptime('Wed Jun 11 19:35:32 2014', '%a %b %d %H:%M:%S %Y'), 'committer_time': datetime.strptime('Wed Jun 11 19:35:32 2014', '%a %b %d %H:%M:%S %Y'), 'commit_url': REV1_COMMIT_LOG_URL, 'code_review_url': None, 'committer_name': '*****@*****.**', 'revision': 'rev1', 'reverted_revision': None } } pipeline = PullChangelogPipeline() change_logs = pipeline.run(failure_info) self.assertEqual(expected_change_logs, change_logs)
def run(self, master_name, builder_name, build_number): self._ResetAnalysis(master_name, builder_name, build_number) # The yield statements below return PipelineFutures, which allow subsequent # pipelines to refer to previous output values. # https://github.com/GoogleCloudPlatform/appengine-pipelines/wiki/Python failure_info = yield DetectFirstFailurePipeline( master_name, builder_name, build_number) change_logs = yield PullChangelogPipeline(failure_info) deps_info = yield ExtractDEPSInfoPipeline(failure_info, change_logs) signals = yield ExtractSignalPipeline(failure_info) yield IdentifyCulpritPipeline(failure_info, change_logs, deps_info, signals)