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

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 <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 24 matching lines...) Expand all
35 }); 35 });
36 36
37 describe('failureByTreeListComparator', function() { 37 describe('failureByTreeListComparator', function() {
38 it('should compare failures correctly', function() { 38 it('should compare failures correctly', function() {
39 var analyzer = new CTFailures(new CTCommitList(undefined, [])); 39 var analyzer = new CTFailures(new CTCommitList(undefined, []));
40 40
41 var cl1 = new CTCommitList(undefined, ['chromium:1', 'blink:2']); 41 var cl1 = new CTCommitList(undefined, ['chromium:1', 'blink:2']);
42 var cl2 = new CTCommitList(undefined, ['chromium:2', 'blink:1']); 42 var cl2 = new CTCommitList(undefined, ['chromium:2', 'blink:1']);
43 var cl3 = new CTCommitList(undefined, ['chromium:2', 'blink:2']); 43 var cl3 = new CTCommitList(undefined, ['chromium:2', 'blink:2']);
44 var cl4 = new CTCommitList(undefined, []); 44 var cl4 = new CTCommitList(undefined, []);
45 var group1 = new CTFailureGroup('', [], cl1); 45 var group1 = new CTFailureGroup('', new CTSheriffFailureGroupData([], cl1) );
46 var group2 = new CTFailureGroup('', [], cl2); 46 var group2 = new CTFailureGroup('', new CTSheriffFailureGroupData([], cl2) );
47 var group3 = new CTFailureGroup('', [], cl3); 47 var group3 = new CTFailureGroup('', new CTSheriffFailureGroupData([], cl3) );
48 var group4 = new CTFailureGroup('', [], cl4); 48 var group4 = new CTFailureGroup('', new CTSheriffFailureGroupData([], cl4) );
49 49
50 // Sort by last revision first. 50 // Sort by last revision first.
51 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) > 0); 51 assert(analyzer._failureByTreeListComparator('chromium', group1, group2) > 0);
52 assert(analyzer._failureByTreeListComparator('chromium', group2, group1) < 0); 52 assert(analyzer._failureByTreeListComparator('chromium', group2, group1) < 0);
53 assert(analyzer._failureByTreeListComparator('chromium', group1, group1) = = 0); 53 assert(analyzer._failureByTreeListComparator('chromium', group1, group1) = = 0);
54 54
55 // If the tree revisions are equal, take others. 55 // If the tree revisions are equal, take others.
56 assert(analyzer._failureByTreeListComparator('chromium', group2, group3) > 0); 56 assert(analyzer._failureByTreeListComparator('chromium', group2, group3) > 0);
57 57
58 // Prioritize the given tree. 58 // Prioritize the given tree.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 }; 168 };
169 simulator.runTest(function() { 169 simulator.runTest(function() {
170 var analyzer = new CTFailures(CTCommitLogMock()); 170 var analyzer = new CTFailures(CTCommitLogMock());
171 return analyzer.update().then(function() { 171 return analyzer.update().then(function() {
172 assert.property(analyzer.failures, 'chromium'); 172 assert.property(analyzer.failures, 'chromium');
173 assert.lengthOf(analyzer.failures.chromium, 1); 173 assert.lengthOf(analyzer.failures.chromium, 1);
174 var group = analyzer.failures.chromium[0]; 174 var group = analyzer.failures.chromium[0];
175 assert.equal(group.constructor, CTFailureGroup); 175 assert.equal(group.constructor, CTFailureGroup);
176 assert.equal(group.key, 'linux: Linux Tests (dbg)(1)'); 176 assert.equal(group.key, 'linux: Linux Tests (dbg)(1)');
177 assert.lengthOf(group.failures, 1); 177 assert.lengthOf(group.data.failures, 1);
178 var failure = group.failures[0]; 178 var failure = group.data.failures[0];
179 assert.equal(failure.constructor, CTFailure); 179 assert.equal(failure.constructor, CTFailure);
180 assert.equal(failure.key, 'compile::null'); 180 assert.equal(failure.key, 'compile::null');
181 assert.equal(failure.step, 'compile'); 181 assert.equal(failure.step, 'compile');
182 assert.equal(failure.testName, null); 182 assert.equal(failure.testName, null);
183 var resultNodesByBuilder = failure.resultNodesByBuilder; 183 var resultNodesByBuilder = failure.resultNodesByBuilder;
184 assert.property(resultNodesByBuilder, 'Linux Tests (dbg)(1)'); 184 assert.property(resultNodesByBuilder, 'Linux Tests (dbg)(1)');
185 var dbgBuilder = resultNodesByBuilder['Linux Tests (dbg)(1)']; 185 var dbgBuilder = resultNodesByBuilder['Linux Tests (dbg)(1)'];
186 assert.propertyVal(dbgBuilder, 'actual', 'UNKNOWN'); 186 assert.propertyVal(dbgBuilder, 'actual', 'UNKNOWN');
187 assert.propertyVal(dbgBuilder, 'lastFailingBuild', 2489); 187 assert.propertyVal(dbgBuilder, 'lastFailingBuild', 2489);
188 assert.propertyVal(dbgBuilder, 'earliestFailingBuild', 2486); 188 assert.propertyVal(dbgBuilder, 'earliestFailingBuild', 2486);
189 assert.propertyVal(dbgBuilder, 'masterUrl', 'https://build.chromium.or g/p/chromium.linux'); 189 assert.propertyVal(dbgBuilder, 'masterUrl', 'https://build.chromium.or g/p/chromium.linux');
190 assert.propertyVal(dbgBuilder, 'failingBuildCount', 4); 190 assert.propertyVal(dbgBuilder, 'failingBuildCount', 4);
191 191
192 var commitList = group.commitList; 192 var commitList = group.data.commitList;
193 assert.equal(commitList.constructor, CTCommitList); 193 assert.equal(commitList.constructor, CTCommitList);
194 assert.lengthOf(commitList.repositories, 1); 194 assert.lengthOf(commitList.repositories, 1);
195 var repositoryCommitList = commitList.repositories[0]; 195 var repositoryCommitList = commitList.repositories[0];
196 assert.propertyVal(repositoryCommitList, 'range', '100 : 101'); 196 assert.propertyVal(repositoryCommitList, 'range', '100 : 101');
197 assert.propertyVal(repositoryCommitList, 'expanded', false); 197 assert.propertyVal(repositoryCommitList, 'expanded', false);
198 198
199 // Flip |expanded| to true to check that it's preserved across updates . 199 // Flip |expanded| to true to check that it's preserved across updates .
200 repositoryCommitList.expanded = true; 200 repositoryCommitList.expanded = true;
201 201
202 // Update |netData| to make sure it's propagated into the updated valu es. 202 // Update |netData| to make sure it's propagated into the updated valu es.
203 netData.alerts.alerts[0].last_failing_build = 2490; 203 netData.alerts.alerts[0].last_failing_build = 2490;
204 204
205 return analyzer.update().then(function() { 205 return analyzer.update().then(function() {
206 console.log(analyzer.failures.chromium[0].data.failures[0].resultNod esByBuilder["Linux Tests (dbg)(1)"].lastFailingBuild);
207 console.log(group.data.failures[0].resultNodesByBuilder["Linux Tests (dbg)(1)"].lastFailingBuild);
206 assert.strictEqual(analyzer.failures.chromium[0], group) 208 assert.strictEqual(analyzer.failures.chromium[0], group)
207 assert.strictEqual(group.failures[0], failure) 209 assert.strictEqual(group.data.failures[0], failure)
208 assert.strictEqual(failure.resultNodesByBuilder, resultNodesByBuilde r); 210 assert.strictEqual(failure.resultNodesByBuilder, resultNodesByBuilde r);
209 assert.strictEqual(resultNodesByBuilder['Linux Tests (dbg)(1)'], dbg Builder); 211 assert.strictEqual(resultNodesByBuilder['Linux Tests (dbg)(1)'], dbg Builder);
210 assert.propertyVal(dbgBuilder, 'lastFailingBuild', 2490); 212 assert.propertyVal(dbgBuilder, 'lastFailingBuild', 2490);
211 213
212 assert.strictEqual(group.commitList, commitList); 214 assert.strictEqual(group.data.commitList, commitList);
213 assert.strictEqual(commitList.repositories[0], repositoryCommitList) ; 215 assert.strictEqual(commitList.repositories[0], repositoryCommitList) ;
214 assert.propertyVal(repositoryCommitList, 'expanded', true); 216 assert.propertyVal(repositoryCommitList, 'expanded', true);
215 }); 217 });
216 }); 218 });
217 }); 219 });
218 }); 220 });
219 }); 221 });
220 222
223 describe('processTrooperFailures', function() {
224 it('should filter out updates that are not alerts', function() {
225 var analyzer = new CTFailures(new CTCommitList(undefined, []));
226 analyzer._processTrooperFailures(
227 {'key_1': {'tree_1': {should_alert: true, should_appear: true},
228 'tree_2': {should_alert: false, should_appear: false}},
229 'key_2': {'tree_3': {should_alert: false, should_appear: false},
230 'tree_4': {should_alert: true, should_appear: true}}});
231 analyzer.failures['trooper'].forEach(function(failure) {
232 assert(failure.data.data.should_appear);
233 });
234 assert(analyzer.failures['trooper'].length == 2);
235 });
236 });
237
221 }); 238 });
222 239
223 })() 240 })()
224 </script> 241 </script>
OLDNEW
« no previous file with comments | « Tools/GardeningServer/model/test/ct-failure-group-tests.html ('k') | Tools/GardeningServer/test/run-unit-tests.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698