OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <link rel="import" href="../ct-failures.html"> | 7 <link rel="import" href="../ct-failures.html"> |
8 | 8 |
9 <link rel="import" href="../../lib/network-simulator.html"> | 9 <link rel="import" href="../../lib/network-simulator.html"> |
10 <link rel="import" href="../ct-commit-list.html"> | 10 <link rel="import" href="../ct-commit-list.html"> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 }); | 68 }); |
69 }); | 69 }); |
70 | 70 |
71 describe('._mungeAlerts', function() { | 71 describe('._mungeAlerts', function() { |
72 it('puts alerts into a standard format', function() { | 72 it('puts alerts into a standard format', function() { |
73 var analyzer = new CTFailures(new CTCommitList(undefined, [])); | 73 var analyzer = new CTFailures(new CTCommitList(undefined, [])); |
74 var alerts = [ | 74 var alerts = [ |
75 { | 75 { |
76 reason: 'reason', | 76 reason: 'reason', |
77 master_url: 'https://build.chromium.org/p/chromium.webkit', | 77 master_url: 'https://build.chromium.org/p/chromium.webkit', |
| 78 tree: 'blink', |
78 }, | 79 }, |
79 { | 80 { |
80 reason: 'reason:type', | 81 reason: 'reason:type', |
81 master_url: 'https://build.chromium.org/p/chromium.chrome', | 82 master_url: 'https://build.chromium.org/p/chromium.chrome', |
| 83 tree: 'chromium', |
82 }, | 84 }, |
83 { | 85 { |
84 master_url: 'https://build.chromium.org/p/chromium.gpu', | 86 master_url: 'https://build.chromium.org/p/chromium.gpu', |
| 87 tree: 'chromium', |
85 }, | 88 }, |
86 { | 89 { |
87 reason: 'reason:type', | 90 reason: 'reason:type', |
88 failureType: 'actual_type', | 91 failureType: 'actual_type', |
| 92 tree: undefined, |
89 }, | 93 }, |
90 ]; | 94 ]; |
91 analyzer._mungeAlerts(alerts); | 95 analyzer._mungeAlerts(alerts); |
92 assert.lengthOf(alerts, 4); | 96 assert.lengthOf(alerts, 4); |
93 assert.deepEqual(alerts[0], { | 97 assert.deepEqual(alerts[0], { |
94 reason: 'reason', | 98 reason: 'reason', |
95 failureType: 'FAIL', | 99 failureType: 'FAIL', |
96 master_url: 'https://build.chromium.org/p/chromium.webkit', | 100 master_url: 'https://build.chromium.org/p/chromium.webkit', |
97 tree: 'blink', | 101 tree: 'blink', |
98 }); | 102 }); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 reason: null, | 269 reason: null, |
266 failing_revisions: { | 270 failing_revisions: { |
267 v8: 50, | 271 v8: 50, |
268 chromium: 101, | 272 chromium: 101, |
269 nacl: 50, | 273 nacl: 50, |
270 blink: 50 | 274 blink: 50 |
271 }, | 275 }, |
272 builder_name: "Linux Tests (dbg)(1)", | 276 builder_name: "Linux Tests (dbg)(1)", |
273 key: "f1", | 277 key: "f1", |
274 step_name: "compile", | 278 step_name: "compile", |
275 tree_name: null, | 279 tree: 'chromium', |
276 passing_revisions: { | 280 passing_revisions: { |
277 v8: 50, | 281 v8: 50, |
278 chromium: 99, | 282 chromium: 99, |
279 nacl: 50, | 283 nacl: 50, |
280 blink: 50 | 284 blink: 50 |
281 }, | 285 }, |
282 would_close_tree: true | 286 would_close_tree: true |
283 }, | 287 }, |
284 ], | 288 ], |
285 } | 289 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 'tree_2': {should_alert: false, should_appear: false}}, | 359 'tree_2': {should_alert: false, should_appear: false}}, |
356 'key_2': {'tree_3': {should_alert: false, should_appear: false}, | 360 'key_2': {'tree_3': {should_alert: false, should_appear: false}, |
357 'tree_4': {should_alert: true, should_appear: true}}}); | 361 'tree_4': {should_alert: true, should_appear: true}}}); |
358 analyzer.failures['trooper'].forEach(function(failure) { | 362 analyzer.failures['trooper'].forEach(function(failure) { |
359 assert(failure.data.data.should_appear); | 363 assert(failure.data.data.should_appear); |
360 }); | 364 }); |
361 assert(analyzer.failures['trooper'].length == 2); | 365 assert(analyzer.failures['trooper'].length == 2); |
362 }); | 366 }); |
363 }); | 367 }); |
364 | 368 |
| 369 describe('processFailuresForRangeGroup', function() { |
| 370 it('should use tree name from json', function() { |
| 371 var analyzer = new CTFailures(null); |
| 372 |
| 373 var annotations = Promise.resolve({ |
| 374 'test-key': 'test-annotation', |
| 375 }) |
| 376 var range_groups = { |
| 377 'failure_keys': ['test-key'], |
| 378 'likely_revisions': [] |
| 379 } |
| 380 var alertsByKey = { |
| 381 'test-key': { |
| 382 'key': 'test-key', |
| 383 'step_name': 'bot_update', |
| 384 'tree': 'test-tree', |
| 385 'builder_name': 'Linux', |
| 386 'last_failing_build': 1234, |
| 387 'failing_build': 1234, |
| 388 'master_url': 'http://build.chromium.org/p/chromium', |
| 389 'failing_build_count': 1, |
| 390 'reason': 'test-reason', |
| 391 } |
| 392 } |
| 393 var newFailures = {} |
| 394 |
| 395 analyzer._processFailuresForRangeGroup(newFailures, range_groups, alertsBy
Key, annotations) |
| 396 assert.ok('test-tree' in newFailures) |
| 397 assert.notOk('chromium' in newFailures) |
| 398 }); |
| 399 }); |
| 400 |
365 }); | 401 }); |
366 | 402 |
367 })() | 403 })() |
368 </script> | 404 </script> |
OLD | NEW |