Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: appengine/findit/waterfall/test/extract_deps_info_pipeline_test.py

Issue 1154593005: [Findit] Add a sub-pipeline to analyze failures caused by DEPS rolls. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Improve readability. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 common import chromium_deps
9 from common.dependency import Dependency
10 from common.diff import ChangeType
11 from waterfall.extract_deps_info_pipeline import ExtractDEPSInfoPipeline
12
13
14 class ExtractDEPSInfoPipelineTest(testing.AppengineTestCase):
15 app_module = handlers._APP
16
17 def testExtractDEPSInfo(self):
18 def MockGetChromeDependency(revision, os_platform):
19 self.assertEqual('unix', os_platform)
20 if revision == 'rev2':
21 return {
22 'src/': Dependency('src/', 'https://url_src', 'rev2', 'DEPS'),
23 'src/dep1': Dependency('src/dep1', 'https://url_dep1', '9', 'DEPS'),
24 }
25 else:
26 self.assertEqual('rev2^', revision)
27 return {
28 'src/': Dependency('src/', 'https://url_src', 'rev2^', 'DEPS'),
29 'src/dep1': Dependency('src/dep1', 'https://url_dep1', '7', 'DEPS'),
30 }
31
32 self.mock(chromium_deps, 'GetChromeDependency', MockGetChromeDependency)
33
34 failure_info = {
35 'chromium_revision': 'rev2',
36 'master_name': 'chromium.linux',
37 'builder_name': 'Linux Tests',
38 }
39 change_logs = {
40 'rev2': {
41 'touched_files': [
42 {
43 'change_type': ChangeType.MODIFY,
44 'old_path': 'DEPS',
45 'new_path': 'DEPS'
46 },
47 ]
48 },
49 'rev1': {
50 'touched_files': [
51 {
52 'change_type': ChangeType.MODIFY,
53 'old_path': 'a/file.cc',
54 'new_path': 'a/file.cc'
55 },
56 ]
57 },
58 }
59 expected_deps_info = {
60 'deps': {
61 'src/': {
62 'repo_url': 'https://url_src',
63 'revision': 'rev2',
64 },
65 'src/dep1': {
66 'repo_url': 'https://url_dep1',
67 'revision': '9',
68 },
69 },
70 'deps_rolls': {
71 'rev2': [
72 {
73 'path': 'src/dep1',
74 'repo_url': 'https://url_dep1',
75 'old_revision': '7',
76 'new_revision': '9',
77 },
78 ]
79 }
80 }
81
82 pipeline = ExtractDEPSInfoPipeline()
83 deps_info = pipeline.run(failure_info, change_logs)
84 self.assertEqual(expected_deps_info, deps_info)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698