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

Side by Side Diff: Tools/GardeningServer/model/test/ct-failures-tests.html

Issue 476903004: [sheriff-o-matic]: Basic trooper display for sheriff-o-matic. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
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 <script> 9 <script>
10 (function () { 10 (function () {
(...skipping 18 matching lines...) Expand all
29 }); 29 });
30 30
31 describe('failureByTreeListComparator', function() { 31 describe('failureByTreeListComparator', function() {
32 it('should compare failures correctly', function() { 32 it('should compare failures correctly', function() {
33 var analyzer = new CTFailures(new CTCommitList(undefined, [])); 33 var analyzer = new CTFailures(new CTCommitList(undefined, []));
34 34
35 var cl1 = new CTCommitList(undefined, ['chromium:1', 'blink:2']); 35 var cl1 = new CTCommitList(undefined, ['chromium:1', 'blink:2']);
36 var cl2 = new CTCommitList(undefined, ['chromium:2', 'blink:1']); 36 var cl2 = new CTCommitList(undefined, ['chromium:2', 'blink:1']);
37 var cl3 = new CTCommitList(undefined, ['chromium:2', 'blink:2']); 37 var cl3 = new CTCommitList(undefined, ['chromium:2', 'blink:2']);
38 var cl4 = new CTCommitList(undefined, []); 38 var cl4 = new CTCommitList(undefined, []);
39 var group1 = new CTFailureGroup([], cl1); 39 var group1 = new CTFailureGroup(new CTSheriffFailureGroupData([], cl1));
40 var group2 = new CTFailureGroup([], cl2); 40 var group2 = new CTFailureGroup(new CTSheriffFailureGroupData([], cl2));
41 var group3 = new CTFailureGroup([], cl3); 41 var group3 = new CTFailureGroup(new CTSheriffFailureGroupData([], cl3));
42 var group4 = new CTFailureGroup([], cl4); 42 var group4 = new CTFailureGroup(new CTSheriffFailureGroupData([], cl4));
43 43
44 // Sort by last revision first. 44 // Sort by last revision first.
45 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) > 0); 45 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) > 0);
46 assert(analyzer._failureByTreeListComparator('chromium', group2, group1) < 0); 46 assert(analyzer._failureByTreeListComparator('chromium', group2, group1) < 0);
47 assert(analyzer._failureByTreeListComparator('chromium', group1, group1) = = 0); 47 assert(analyzer._failureByTreeListComparator('chromium', group1, group1) = = 0);
48 48
49 // If the tree revisions are equal, take others. 49 // If the tree revisions are equal, take others.
50 assert(analyzer._failureByTreeListComparator('chromium', group2, group3) > 0); 50 assert(analyzer._failureByTreeListComparator('chromium', group2, group3) > 0);
51 51
52 // Prioritize the given tree. 52 // Prioritize the given tree.
53 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) > 0); 53 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) > 0);
54 assert(analyzer._failureByTreeListComparator('blink', group1, group2) < 0) ; 54 assert(analyzer._failureByTreeListComparator('blink', group1, group2) < 0) ;
55 55
56 // Default to 'chromium'. 56 // Default to 'chromium'.
57 assert(analyzer._failureByTreeListComparator(undefined, group1, group2) > 0); 57 assert(analyzer._failureByTreeListComparator(undefined, group1, group2) > 0);
58 58
59 // Failures without a revision go to the end. 59 // Failures without a revision go to the end.
60 assert(analyzer._failureByTreeListComparator('chromium', group4, group1) > 0); 60 assert(analyzer._failureByTreeListComparator('chromium', group4, group1) > 0);
61 }); 61 });
62 }); 62 });
63
64 describe('processTrooperFailures', function() {
65 it('should filter out updates that are not alerts', function() {
66 var analyzer = new CTFailures(new CTCommitList(undefined, []));
67 analyzer._processTrooperFailures(
68 {'key_1': {'tree_1': {should_alert: true, should_appear: true},
69 'tree_2': {should_alert: false, should_appear: false}},
70 'key_2': {'tree_3': {should_alert: false, should_appear: false},
71 'tree_4': {should_alert: true, should_appear: true}}});
72 analyzer.failures['trooper'].forEach(function(failure) {
73 assert(failure.data.data.should_appear);
74 });
75 assert(analyzer.failures['trooper'].length == 2);
76 });
77 });
78
63 }); 79 });
64 80
65 })() 81 })()
66 </script> 82 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698