OLD | NEW |
---|---|
(Empty) | |
1 package model | |
2 | |
3 import ( | |
4 "math" | |
5 "testing" | |
6 | |
7 . "github.com/smartystreets/goconvey/convey" | |
8 ) | |
9 | |
10 func TestMerge(t *testing.T) { | |
11 t.Parallel() | |
12 | |
13 Convey("Merge", t, func() { | |
14 Convey("AggregateTestLeaf", func() { | |
15 leaf := &AggregateTestLeaf{ | |
16 Bugs: []string{"crbug.com/baz"}, | |
17 Expected: []string{"FAIL"}, | |
18 Results: []ResultSummary{{2, "P"}, {30, "F"}}, | |
19 Runtimes: []RuntimeSummary{{1, 500}, {4, 750}, { 1, 250}}, | |
20 } | |
21 x := &AggregateTestLeaf{ | |
22 Bugs: []string{"crbug.com/foo", "crbug.com/b ar"}, | |
23 Results: []ResultSummary{{1, "P"}, {42, "X"}}, | |
24 Runtimes: []RuntimeSummary{{2, 5000}, {4, 5000}, {8, 6000}}, | |
25 } | |
26 | |
27 Convey("Use x.Bugs, x.Expected", func() { | |
28 x.Expected = []string{"FAIL PASS"} | |
29 So(leaf.Merge(x), ShouldBeNil) | |
30 So(leaf.Bugs, ShouldResemble, x.Bugs) | |
31 So(leaf.Expected, ShouldResemble, x.Expected) | |
32 }) | |
33 | |
34 Convey(`Do not use x.Expected if == "PASS"`, func() { | |
35 x.Expected = []string{"PASS"} | |
36 So(leaf.Merge(x), ShouldBeNil) | |
37 So(leaf.Bugs, ShouldResemble, x.Bugs) | |
38 So(leaf.Expected, ShouldResemble, []string{"FAIL "}) | |
39 }) | |
40 | |
41 Convey("Merge matching Results", func() { | |
42 So(leaf.Merge(x), ShouldBeNil) | |
43 So(leaf.Results, ShouldResemble, []ResultSummary { | |
44 {42, "X"}, | |
45 {3, "P"}, | |
46 {30, "F"}, | |
47 }) | |
48 }) | |
49 | |
50 Convey("Merge matching Runtimes", func() { | |
51 So(leaf.Merge(x), ShouldBeNil) | |
52 So(leaf.Runtimes, ShouldResemble, []RuntimeSumma ry{ | |
53 {8, 6000}, | |
54 {6, 5000}, | |
55 {1, 500}, | |
56 {4, 750}, | |
57 {1, 250}, | |
58 }) | |
59 }) | |
60 }) | |
61 | |
62 Convey("AggregateTest", func() { | |
63 Convey("Join all AggregateTest multi-level", func() { | |
64 at := AggregateTest{ | |
65 "foo": &AggregateTestLeaf{ | |
66 Results: []ResultSummary{{10, " P"}}, | |
67 Runtimes: []RuntimeSummary{{1, 2 }}, | |
68 }, | |
69 "qux": AggregateTest{ | |
70 "experiment": &AggregateTestLeaf { | |
71 Results: []ResultSummar y{{20, "A"}}, | |
72 Runtimes: []RuntimeSumma ry{{3, 5}}, | |
73 }, | |
74 "paper": &AggregateTestLeaf{ | |
75 Results: []ResultSummar y{{1, "B"}}, | |
76 Runtimes: []RuntimeSumma ry{{30, 10}}, | |
77 }, | |
78 }, | |
79 } | |
80 x := AggregateTest{ | |
81 "bar": &AggregateTestLeaf{ | |
82 Results: []ResultSummary{{20, " F"}}, | |
83 Runtimes: []RuntimeSummary{{3, 0 }}, | |
84 }, | |
85 "qux": AggregateTest{ | |
86 "paper": &AggregateTestLeaf{ | |
87 Results: []ResultSummar y{{6, "F"}}, | |
88 Runtimes: []RuntimeSumma ry{{2, 3}}, | |
89 }, | |
90 "pencil": &AggregateTestLeaf{ | |
91 Results: []ResultSummar y{{75, "Z"}}, | |
92 Runtimes: []RuntimeSumma ry{{15, 60}}, | |
93 }, | |
94 }, | |
95 } | |
96 expected := AggregateTest{ | |
97 "foo": &AggregateTestLeaf{ | |
98 Results: []ResultSummary{{1, "N "}, {10, "P"}}, | |
99 Runtimes: []RuntimeSummary{{1, 0 }, {1, 2}}, | |
100 }, | |
101 "bar": &AggregateTestLeaf{ | |
102 Results: []ResultSummary{{20, " F"}}, | |
103 Runtimes: []RuntimeSummary{{3, 0 }}, | |
104 }, | |
105 "qux": AggregateTest{ | |
106 "experiment": &AggregateTestLeaf { | |
107 Results: []ResultSummar y{{1, "N"}, {20, "A"}}, | |
108 Runtimes: []RuntimeSumma ry{{1, 0}, {3, 5}}, | |
109 }, | |
110 "paper": &AggregateTestLeaf{ | |
111 Results: []ResultSummar y{{6, "F"}, {1, "B"}}, | |
112 Runtimes: []RuntimeSumma ry{{2, 3}, {30, 10}}, | |
113 }, | |
114 "pencil": &AggregateTestLeaf{ | |
115 Results: []ResultSummar y{{75, "Z"}}, | |
116 Runtimes: []RuntimeSumma ry{{15, 60}}, | |
117 }, | |
118 }, | |
119 } | |
120 So(at.Merge(x), ShouldBeNil) | |
121 So(at, ShouldResemble, expected) | |
122 }) | |
123 | |
124 Convey("Mismatched type", func() { | |
125 Convey("*AggregateTestLeaf in at, AggregateTest in x", func() { | |
126 at := AggregateTest{ | |
127 "foo": AggregateTest{ | |
128 "bar": &AggregateTestLea f{ | |
129 Results: []Resu ltSummary{{10, "P"}}, | |
130 Runtimes: []Runt imeSummary{{1, 2}}, | |
131 }, | |
132 }, | |
133 } | |
134 x := AggregateTest{ | |
135 "foo": AggregateTest{ | |
136 "bar": AggregateTest{ | |
137 "baz": &Aggregat eTestLeaf{ | |
138 Results: []ResultSummary{{20, "F"}}, | |
139 Runtimes : []RuntimeSummary{{3, 0}}, | |
140 }, | |
141 }, | |
142 }, | |
143 } | |
144 err := at.Merge(x) | |
145 So(err, ShouldNotBeNil) | |
146 So(err.Error(), ShouldContainSubstring, " *AggregateTestLeaf") | |
147 }) | |
148 | |
149 Convey("AggregateTest in at, *AggregateTestLeaf in x", func() { | |
martiniss
2016/08/12 00:14:24
"at" and "x" are implementation details. Could jus
nishanths
2016/08/12 02:37:39
Done, thanks!
| |
150 at := AggregateTest{ | |
151 "foo": AggregateTest{ | |
152 "bar": &AggregateTestLea f{ | |
153 Results: []Resu ltSummary{{10, "P"}}, | |
154 Runtimes: []Runt imeSummary{{1, 2}}, | |
155 }, | |
156 }, | |
157 } | |
158 x := AggregateTest{ | |
159 "foo": &AggregateTestLeaf{ | |
160 Results: []ResultSummar y{{20, "F"}}, | |
161 Runtimes: []RuntimeSumma ry{{3, 0}}, | |
162 }, | |
163 } | |
164 err := at.Merge(x) | |
165 So(err, ShouldNotBeNil) | |
166 So(err.Error(), ShouldContainSubstring, " AggregateTest") | |
167 }) | |
168 }) | |
169 | |
170 Convey("Merge (all together)", func() { | |
171 at := AggregateTest{ | |
172 "presentation": AggregateTest{ | |
173 "presentation": &AggregateTestLe af{ | |
174 Results: []ResultSummar y{{10, "P"}}, | |
175 Runtimes: []RuntimeSumma ry{{1, 2}}, | |
176 }, | |
177 "readme": &AggregateTestLeaf{ | |
178 Results: []ResultSummar y{{20, "Q"}}, | |
179 Runtimes: []RuntimeSumma ry{{3, 4}}, | |
180 }, | |
181 }, | |
182 "io": AggregateTest{ | |
183 "serial": &AggregateTestLeaf{ | |
184 Results: []ResultSummar y{{40, "S"}}, | |
185 Runtimes: []RuntimeSumma ry{{8, 9}}, | |
186 }, | |
187 }, | |
188 "hello": AggregateTest{ | |
189 "world": AggregateTest{ | |
190 "main": &AggregateTestLe af{ | |
191 Results: []Resu ltSummary{{50, "T"}}, | |
192 Runtimes: []Runt imeSummary{{10, 11}}, | |
193 }, | |
194 }, | |
195 }, | |
196 } | |
197 x := AggregateTest{ | |
198 "presentation": AggregateTest{ | |
199 "presentation": &AggregateTestLe af{ | |
200 Results: []ResultSummar y{{10, "A"}}, | |
201 Runtimes: []RuntimeSumma ry{{1, 2}}, | |
202 }, | |
203 "readme": &AggregateTestLeaf{ | |
204 Results: []ResultSummar y{{10, "B"}}, | |
205 Runtimes: []RuntimeSumma ry{{1, 2}}, | |
206 }, | |
207 }, | |
208 "io": AggregateTest{ | |
209 "analog": &AggregateTestLeaf{ | |
210 Results: []ResultSummar y{{10, "D"}}, | |
211 Runtimes: []RuntimeSumma ry{{3, 0}}, | |
212 }, | |
213 "parallel": AggregateTest{ | |
214 "duplex": &AggregateTest Leaf{ | |
215 Results: []Resu ltSummary{{10, "E"}}, | |
216 Runtimes: []Runt imeSummary{{3, 5}}, | |
217 }, | |
218 "simplex": &AggregateTes tLeaf{ | |
219 Results: []Resu ltSummary{{60, "H"}}, | |
220 Runtimes: []Runt imeSummary{{30, 50}}, | |
221 }, | |
222 }, | |
223 }, | |
224 "cool": AggregateTest{ | |
225 "world": AggregateTest{ | |
226 "main": &AggregateTestLe af{ | |
227 Results: []Resu ltSummary{{10, "F"}}, | |
228 Runtimes: []Runt imeSummary{{3, 6}}, | |
229 }, | |
230 }, | |
231 }, | |
232 } | |
233 expected := AggregateTest{ | |
234 "presentation": AggregateTest{ | |
235 "presentation": &AggregateTestLe af{ | |
236 Results: []ResultSummar y{{10, "A"}, {10, "P"}}, | |
237 Runtimes: []RuntimeSumma ry{{2, 2}}, | |
238 }, | |
239 "readme": &AggregateTestLeaf{ | |
240 Results: []ResultSummar y{{10, "B"}, {20, "Q"}}, | |
241 Runtimes: []RuntimeSumma ry{{1, 2}, {3, 4}}, | |
242 }, | |
243 }, | |
244 "io": AggregateTest{ | |
245 "serial": &AggregateTestLeaf{ | |
246 Results: []ResultSummar y{{1, "N"}, {40, "S"}}, | |
247 Runtimes: []RuntimeSumma ry{{1, 0}, {8, 9}}, | |
248 }, | |
249 "analog": &AggregateTestLeaf{ | |
250 Results: []ResultSummar y{{10, "D"}}, | |
251 Runtimes: []RuntimeSumma ry{{3, 0}}, | |
252 }, | |
253 "parallel": AggregateTest{ | |
254 "duplex": &AggregateTest Leaf{ | |
255 Results: []Resu ltSummary{{10, "E"}}, | |
256 Runtimes: []Runt imeSummary{{3, 5}}, | |
257 }, | |
258 "simplex": &AggregateTes tLeaf{ | |
259 Results: []Resu ltSummary{{60, "H"}}, | |
260 Runtimes: []Runt imeSummary{{30, 50}}, | |
261 }, | |
262 }, | |
263 }, | |
264 "hello": AggregateTest{ | |
265 "world": AggregateTest{ | |
266 "main": &AggregateTestLe af{ | |
267 Results: []Resu ltSummary{{1, "N"}, {50, "T"}}, | |
268 Runtimes: []Runt imeSummary{{1, 0}, {10, 11}}, | |
269 }, | |
270 }, | |
271 }, | |
272 "cool": AggregateTest{ | |
273 "world": AggregateTest{ | |
274 "main": &AggregateTestLe af{ | |
275 Results: []Resu ltSummary{{10, "F"}}, | |
276 Runtimes: []Runt imeSummary{{3, 6}}, | |
277 }, | |
278 }, | |
279 }, | |
280 } | |
281 So(at.Merge(x), ShouldBeNil) | |
282 So(at, ShouldResemble, expected) | |
283 }) | |
284 }) | |
285 | |
286 Convey("AggregateResult", func() { | |
martiniss
2016/08/12 00:14:24
"AggregateResult" merge? What is this testing
nishanths
2016/08/12 02:37:39
Done.
| |
287 ag := &AggregateResult{ | |
288 Version: ResultsVersion, | |
289 Builder: "foo_builder", | |
290 BuilderInfo: &BuilderInfo{ | |
291 SecondsEpoch: []int64{1, 2}, | |
292 BlinkRevs: []Number{3, 4}, | |
293 BuildNumbers: []Number{5, 6}, | |
294 ChromeRevs: []string{"a", "1"}, | |
295 Tests: AggregateTest{ | |
296 "foo": &AggregateTestLeaf{ | |
297 Results: []ResultSummar y{{1, "A"}, {3, "B"}}, | |
298 Runtimes: []RuntimeSumma ry{{1, 2}, {3, 4}}, | |
299 }, | |
300 }, | |
301 FailureMap: FailureLongNames, | |
302 FailuresByType: map[string][]int{ | |
303 "AUDIO": {1, 2, 3, 4}, | |
304 "CRASH": {100, 200}, | |
305 "LEAKY": {0}, | |
306 "PASS": {5}, | |
307 }, | |
308 }, | |
309 } | |
310 x := &AggregateResult{ | |
311 Builder: "foo_builder", | |
312 BuilderInfo: &BuilderInfo{ | |
313 SecondsEpoch: []int64{10, 20}, | |
314 BlinkRevs: []Number{30, 40}, | |
315 BuildNumbers: []Number{50, 60}, | |
316 ChromeRevs: []string{"b", "c"}, | |
317 Tests: AggregateTest{ | |
318 "foo": &AggregateTestLeaf{ | |
319 Results: []ResultSummar y{{1, "C"}, {3, "D"}}, | |
320 Runtimes: []RuntimeSumma ry{{10, 20}, {30, 40}}, | |
321 }, | |
322 }, | |
323 FailureMap: map[string]string{}, | |
324 FailuresByType: map[string][]int{ | |
325 "AUDIO": {80, 90}, | |
326 "CRASH": {110, 220}, | |
327 "FAILURE": {42}, | |
328 "LEAKY": {2}, | |
329 }, | |
330 }, | |
331 } | |
332 expected := &AggregateResult{ | |
333 Version: ResultsVersion, | |
334 Builder: "foo_builder", | |
335 BuilderInfo: &BuilderInfo{ | |
336 SecondsEpoch: []int64{10, 20, 1, 2}, | |
337 BlinkRevs: []Number{30, 40, 3, 4}, | |
338 BuildNumbers: []Number{50, 60, 5, 6}, | |
339 ChromeRevs: []string{"b", "c", "a", "1 "}, | |
340 Tests: AggregateTest{ | |
341 "foo": &AggregateTestLeaf{ | |
342 Results: []ResultSummar y{{3, "D"}, {1, "C"}, {1, "A"}, {3, "B"}}, | |
343 Runtimes: []RuntimeSumma ry{{30, 40}, {10, 20}, {1, 2}, {3, 4}}, | |
344 }, | |
345 }, | |
346 FailureMap: FailureLongNames, | |
347 FailuresByType: map[string][]int{ | |
348 "AUDIO": {80, 90, 1, 2, 3, 4}, | |
349 "CRASH": {110, 220, 100, 200}, | |
350 "FAILURE": {42}, | |
351 "PASS": {5}, | |
352 "LEAKY": {2, 0}, | |
353 }, | |
354 }, | |
355 } | |
356 So(ag.Merge(x), ShouldBeNil) | |
357 So(ag, ShouldResemble, expected) | |
358 }) | |
359 }) | |
360 } | |
361 | |
362 // TestMergeAndTrim tests are ported from "model/test/jsonresults_test.py" | |
363 // in the Python implementation. | |
364 // | |
365 // The test names here correspond to the names in the original file | |
martiniss
2016/08/12 00:14:24
My opinion, but I think you should remove the unde
nishanths
2016/08/12 02:37:40
Done.
| |
366 // except that the "test_merge_" prefix is removed. | |
367 func TestMergeAndTrim(t *testing.T) { | |
368 t.Parallel() | |
369 | |
370 Convey("Test Merge/Trim", t, func() { | |
371 Convey("empty_aggregated_results", func() { | |
372 aggr := &AggregateResult{} | |
373 x := &AggregateResult{ | |
374 BuilderInfo: &BuilderInfo{ | |
375 BuildNumbers: []Number{2, 1}, | |
376 Tests: AggregateTest{ | |
377 "001.html": &AggregateTestLeaf{ | |
378 Results: []ResultSummar y{{200, "F"}}, | |
379 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
380 }, | |
381 }, | |
382 }, | |
383 } | |
384 expected := &AggregateResult{ | |
385 Version: ResultsVersion, | |
386 BuilderInfo: &BuilderInfo{ | |
387 FailureMap: FailureLongNames, | |
388 BuildNumbers: []Number{2, 1}, | |
389 Tests: AggregateTest{ | |
390 "001.html": &AggregateTestLeaf{ | |
391 Results: []ResultSummar y{{200, "F"}}, | |
392 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
393 }, | |
394 }, | |
395 }, | |
396 } | |
397 So(aggr.Merge(x), ShouldBeNil) | |
398 So(aggr, ShouldResemble, expected) | |
399 }) | |
400 | |
401 Convey("duplicate_build_Number", func() { | |
402 aggr := &AggregateResult{ | |
403 BuilderInfo: &BuilderInfo{ | |
404 BuildNumbers: []Number{2, 1}, | |
405 Tests: AggregateTest{ | |
406 "001.html": &AggregateTestLeaf{ | |
407 Results: []ResultSummar y{{100, "F"}}, | |
408 Runtimes: []RuntimeSumma ry{{100, 0}}, | |
409 }, | |
410 }, | |
411 }, | |
412 } | |
413 x := &AggregateResult{ | |
414 BuilderInfo: &BuilderInfo{ | |
415 BuildNumbers: []Number{2}, | |
416 Tests: AggregateTest{ | |
417 "001.html": &AggregateTestLeaf{ | |
418 Results: []ResultSummar y{{1, "F"}}, | |
419 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
420 }, | |
421 }, | |
422 }, | |
423 } | |
424 So(aggr.Merge(x), ShouldEqual, ErrBuildNumberConflict) | |
425 }) | |
426 | |
427 Convey("incremental_single_test_single_run_same_result", func() { | |
428 aggr := &AggregateResult{ | |
429 BuilderInfo: &BuilderInfo{ | |
430 BuildNumbers: []Number{2, 1}, | |
431 Tests: AggregateTest{ | |
432 "001.html": &AggregateTestLeaf{ | |
433 Results: []ResultSummar y{{200, "F"}}, | |
434 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
435 }, | |
436 }, | |
437 }, | |
438 } | |
439 x := &AggregateResult{ | |
440 BuilderInfo: &BuilderInfo{ | |
441 BuildNumbers: []Number{3}, | |
442 Tests: AggregateTest{ | |
443 "001.html": &AggregateTestLeaf{ | |
444 Results: []ResultSummar y{{1, "F"}}, | |
445 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
446 }, | |
447 }, | |
448 }, | |
449 } | |
450 expected := &AggregateResult{ | |
451 Version: ResultsVersion, | |
452 BuilderInfo: &BuilderInfo{ | |
453 FailureMap: FailureLongNames, | |
454 BuildNumbers: []Number{3, 2, 1}, | |
455 Tests: AggregateTest{ | |
456 "001.html": &AggregateTestLeaf{ | |
457 Results: []ResultSummar y{{201, "F"}}, | |
458 Runtimes: []RuntimeSumma ry{{201, 0}}, | |
459 }, | |
460 }, | |
461 }, | |
462 } | |
463 So(aggr.Merge(x), ShouldBeNil) | |
464 So(aggr, ShouldResemble, expected) | |
465 }) | |
466 | |
467 Convey("single_test_single_run_different_result", func() { | |
468 aggr := &AggregateResult{ | |
469 Version: ResultsVersion, | |
470 BuilderInfo: &BuilderInfo{ | |
471 BuildNumbers: []Number{2, 1}, | |
472 Tests: AggregateTest{ | |
473 "001.html": &AggregateTestLeaf{ | |
474 Results: []ResultSummar y{{200, "F"}}, | |
475 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
476 }, | |
477 }, | |
478 }, | |
479 } | |
480 x := &AggregateResult{ | |
481 BuilderInfo: &BuilderInfo{ | |
482 BuildNumbers: []Number{3}, | |
483 Tests: AggregateTest{ | |
484 "001.html": &AggregateTestLeaf{ | |
485 Results: []ResultSummar y{{1, "I"}}, | |
486 Runtimes: []RuntimeSumma ry{{1, 1}}, | |
487 }, | |
488 }, | |
489 }, | |
490 } | |
491 expected := &AggregateResult{ | |
492 Version: ResultsVersion, | |
493 BuilderInfo: &BuilderInfo{ | |
494 FailureMap: FailureLongNames, | |
495 BuildNumbers: []Number{3, 2, 1}, | |
496 Tests: AggregateTest{ | |
497 "001.html": &AggregateTestLeaf{ | |
498 Results: []ResultSummar y{{1, "I"}, {200, "F"}}, | |
499 Runtimes: []RuntimeSumma ry{{1, 1}, {200, 0}}, | |
500 }, | |
501 }, | |
502 }, | |
503 } | |
504 So(aggr.Merge(x), ShouldBeNil) | |
505 So(aggr, ShouldResemble, expected) | |
506 }) | |
507 | |
508 Convey("single_test_single_run,_result_changed", func() { | |
509 aggr := &AggregateResult{ | |
510 BuilderInfo: &BuilderInfo{ | |
511 BuildNumbers: []Number{2, 1}, | |
512 Tests: AggregateTest{ | |
513 "001.html": &AggregateTestLeaf{ | |
514 Results: []ResultSummar y{{200, "F"}, {10, "I"}}, | |
515 Runtimes: []RuntimeSumma ry{{200, 0}, {10, 1}}, | |
516 }, | |
517 }, | |
518 }, | |
519 } | |
520 x := &AggregateResult{ | |
521 BuilderInfo: &BuilderInfo{ | |
522 BuildNumbers: []Number{3}, | |
523 Tests: AggregateTest{ | |
524 "001.html": &AggregateTestLeaf{ | |
525 Results: []ResultSummar y{{1, "I"}}, | |
526 Runtimes: []RuntimeSumma ry{{1, 1}}, | |
527 }, | |
528 }, | |
529 }, | |
530 } | |
531 expected := &AggregateResult{ | |
532 Version: ResultsVersion, | |
533 BuilderInfo: &BuilderInfo{ | |
534 FailureMap: FailureLongNames, | |
535 BuildNumbers: []Number{3, 2, 1}, | |
536 Tests: AggregateTest{ | |
537 "001.html": &AggregateTestLeaf{ | |
538 Results: []ResultSummar y{{1, "I"}, {200, "F"}, {10, "I"}}, | |
539 Runtimes: []RuntimeSumma ry{{1, 1}, {200, 0}, {10, 1}}, | |
540 }, | |
541 }, | |
542 }, | |
543 } | |
544 So(aggr.Merge(x), ShouldBeNil) | |
545 So(aggr, ShouldResemble, expected) | |
546 }) | |
547 | |
548 Convey("multiple_tests_single_run", func() { | |
549 aggr := &AggregateResult{ | |
550 BuilderInfo: &BuilderInfo{ | |
551 BuildNumbers: []Number{2, 1}, | |
552 Tests: AggregateTest{ | |
553 "001.html": &AggregateTestLeaf{ | |
554 Results: []ResultSummar y{{200, "F"}}, | |
555 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
556 }, | |
557 "002.html": &AggregateTestLeaf{ | |
558 Results: []ResultSummar y{{100, "I"}}, | |
559 Runtimes: []RuntimeSumma ry{{100, 1}}, | |
560 }, | |
561 }, | |
562 }, | |
563 } | |
564 x := &AggregateResult{ | |
565 BuilderInfo: &BuilderInfo{ | |
566 BuildNumbers: []Number{3}, | |
567 Tests: AggregateTest{ | |
568 "001.html": &AggregateTestLeaf{ | |
569 Results: []ResultSummar y{{1, "F"}}, | |
570 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
571 }, | |
572 "002.html": &AggregateTestLeaf{ | |
573 Results: []ResultSummar y{{1, "I"}}, | |
574 Runtimes: []RuntimeSumma ry{{1, 1}}, | |
575 }, | |
576 }, | |
577 }, | |
578 } | |
579 expected := &AggregateResult{ | |
580 Version: ResultsVersion, | |
581 BuilderInfo: &BuilderInfo{ | |
582 FailureMap: FailureLongNames, | |
583 BuildNumbers: []Number{3, 2, 1}, | |
584 Tests: AggregateTest{ | |
585 "001.html": &AggregateTestLeaf{ | |
586 Results: []ResultSummar y{{201, "F"}}, | |
587 Runtimes: []RuntimeSumma ry{{201, 0}}, | |
588 }, | |
589 "002.html": &AggregateTestLeaf{ | |
590 Results: []ResultSummar y{{101, "I"}}, | |
591 Runtimes: []RuntimeSumma ry{{101, 1}}, | |
592 }, | |
593 }, | |
594 }, | |
595 } | |
596 So(aggr.Merge(x), ShouldBeNil) | |
597 So(aggr, ShouldResemble, expected) | |
598 }) | |
599 | |
600 Convey("multiple_tests_single_run_no_result", func() { | |
601 aggr := &AggregateResult{ | |
602 BuilderInfo: &BuilderInfo{ | |
603 BuildNumbers: []Number{2, 1}, | |
604 Tests: AggregateTest{ | |
605 "001.html": &AggregateTestLeaf{ | |
606 Results: []ResultSummar y{{200, "F"}}, | |
607 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
608 }, | |
609 "002.html": &AggregateTestLeaf{ | |
610 Results: []ResultSummar y{{100, "I"}}, | |
611 Runtimes: []RuntimeSumma ry{{100, 1}}, | |
612 }, | |
613 }, | |
614 }, | |
615 } | |
616 x := &AggregateResult{ | |
617 BuilderInfo: &BuilderInfo{ | |
618 BuildNumbers: []Number{3}, | |
619 Tests: AggregateTest{ | |
620 "002.html": &AggregateTestLeaf{ | |
621 Results: []ResultSummar y{{1, "I"}}, | |
622 Runtimes: []RuntimeSumma ry{{1, 1}}, | |
623 }, | |
624 }, | |
625 }, | |
626 } | |
627 expected := &AggregateResult{ | |
628 Version: ResultsVersion, | |
629 BuilderInfo: &BuilderInfo{ | |
630 FailureMap: FailureLongNames, | |
631 BuildNumbers: []Number{3, 2, 1}, | |
632 Tests: AggregateTest{ | |
633 "001.html": &AggregateTestLeaf{ | |
634 Results: []ResultSummar y{{1, "N"}, {200, "F"}}, | |
635 Runtimes: []RuntimeSumma ry{{201, 0}}, | |
636 }, | |
637 "002.html": &AggregateTestLeaf{ | |
638 Results: []ResultSummar y{{101, "I"}}, | |
639 Runtimes: []RuntimeSumma ry{{101, 1}}, | |
640 }, | |
641 }, | |
642 }, | |
643 } | |
644 So(aggr.Merge(x), ShouldBeNil) | |
645 So(aggr, ShouldResemble, expected) | |
646 }) | |
647 | |
648 Convey("single_test_multiple_runs", func() { | |
649 aggr := &AggregateResult{ | |
650 BuilderInfo: &BuilderInfo{ | |
651 BuildNumbers: []Number{2, 1}, | |
652 Tests: AggregateTest{ | |
653 "001.html": &AggregateTestLeaf{ | |
654 Results: []ResultSummar y{{200, "F"}}, | |
655 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
656 }, | |
657 }, | |
658 }, | |
659 } | |
660 x := &AggregateResult{ | |
661 BuilderInfo: &BuilderInfo{ | |
662 BuildNumbers: []Number{4, 3}, | |
663 Tests: AggregateTest{ | |
664 "001.html": &AggregateTestLeaf{ | |
665 Results: []ResultSummar y{{2, "I"}, {1, "Q"}}, | |
666 Runtimes: []RuntimeSumma ry{{3, 2}}, | |
667 }, | |
668 }, | |
669 }, | |
670 } | |
671 expected := &AggregateResult{ | |
672 Version: ResultsVersion, | |
673 BuilderInfo: &BuilderInfo{ | |
674 FailureMap: FailureLongNames, | |
675 BuildNumbers: []Number{4, 3, 2, 1}, | |
676 Tests: AggregateTest{ | |
677 "001.html": &AggregateTestLeaf{ | |
678 Results: []ResultSummar y{{1, "Q"}, {2, "I"}, {200, "F"}}, | |
679 Runtimes: []RuntimeSumma ry{{3, 2}, {200, 0}}, | |
680 }, | |
681 }, | |
682 }, | |
683 } | |
684 So(aggr.Merge(x), ShouldBeNil) | |
685 So(aggr, ShouldResemble, expected) | |
686 }) | |
687 | |
688 Convey("multiple_tests_multiple_runs", func() { | |
689 aggr := &AggregateResult{ | |
690 BuilderInfo: &BuilderInfo{ | |
691 BuildNumbers: []Number{2, 1}, | |
692 Tests: AggregateTest{ | |
693 "001.html": &AggregateTestLeaf{ | |
694 Results: []ResultSummar y{{200, "F"}}, | |
695 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
696 }, | |
697 "002.html": &AggregateTestLeaf{ | |
698 Results: []ResultSummar y{{10, "Z"}}, | |
699 Runtimes: []RuntimeSumma ry{{10, 0}}, | |
700 }, | |
701 }, | |
702 }, | |
703 } | |
704 x := &AggregateResult{ | |
705 BuilderInfo: &BuilderInfo{ | |
706 BuildNumbers: []Number{4, 3}, | |
707 Tests: AggregateTest{ | |
708 "001.html": &AggregateTestLeaf{ | |
709 Results: []ResultSummar y{{2, "I"}}, | |
710 Runtimes: []RuntimeSumma ry{{2, 2}}, | |
711 }, | |
712 "002.html": &AggregateTestLeaf{ | |
713 Results: []ResultSummar y{{1, "C"}}, | |
714 Runtimes: []RuntimeSumma ry{{1, 1}}, | |
715 }, | |
716 }, | |
717 }, | |
718 } | |
719 expected := &AggregateResult{ | |
720 Version: ResultsVersion, | |
721 BuilderInfo: &BuilderInfo{ | |
722 FailureMap: FailureLongNames, | |
723 BuildNumbers: []Number{4, 3, 2, 1}, | |
724 Tests: AggregateTest{ | |
725 "001.html": &AggregateTestLeaf{ | |
726 Results: []ResultSummar y{{2, "I"}, {200, "F"}}, | |
727 Runtimes: []RuntimeSumma ry{{2, 2}, {200, 0}}, | |
728 }, | |
729 "002.html": &AggregateTestLeaf{ | |
730 Results: []ResultSummar y{{1, "C"}, {10, "Z"}}, | |
731 Runtimes: []RuntimeSumma ry{{1, 1}, {10, 0}}, | |
732 }, | |
733 }, | |
734 }, | |
735 } | |
736 So(aggr.Merge(x), ShouldBeNil) | |
737 So(aggr, ShouldResemble, expected) | |
738 }) | |
739 | |
740 Convey("incremental_result_older_build", func() { | |
741 aggr := &AggregateResult{ | |
742 BuilderInfo: &BuilderInfo{ | |
743 BuildNumbers: []Number{3, 1}, | |
744 Tests: AggregateTest{ | |
745 "001.html": &AggregateTestLeaf{ | |
746 Results: []ResultSummar y{{5, "F"}}, | |
747 Runtimes: []RuntimeSumma ry{{5, 0}}, | |
748 }, | |
749 }, | |
750 }, | |
751 } | |
752 x := &AggregateResult{ | |
753 BuilderInfo: &BuilderInfo{ | |
754 BuildNumbers: []Number{2}, | |
755 Tests: AggregateTest{ | |
756 "001.html": &AggregateTestLeaf{ | |
757 Results: []ResultSummar y{{1, "F"}}, | |
758 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
759 }, | |
760 }, | |
761 }, | |
762 } | |
763 expected := &AggregateResult{ | |
764 Version: ResultsVersion, | |
765 BuilderInfo: &BuilderInfo{ | |
766 FailureMap: FailureLongNames, | |
767 BuildNumbers: []Number{2, 3, 1}, | |
768 Tests: AggregateTest{ | |
769 "001.html": &AggregateTestLeaf{ | |
770 Results: []ResultSummar y{{6, "F"}}, | |
771 Runtimes: []RuntimeSumma ry{{6, 0}}, | |
772 }, | |
773 }, | |
774 }, | |
775 } | |
776 So(aggr.Merge(x), ShouldBeNil) | |
777 So(aggr, ShouldResemble, expected) | |
778 }) | |
779 | |
780 Convey("incremental_result_same_build", func() { | |
781 aggr := &AggregateResult{ | |
782 BuilderInfo: &BuilderInfo{ | |
783 BuildNumbers: []Number{2, 1}, | |
784 Tests: AggregateTest{ | |
785 "001.html": &AggregateTestLeaf{ | |
786 Results: []ResultSummar y{{5, "F"}}, | |
787 Runtimes: []RuntimeSumma ry{{5, 0}}, | |
788 }, | |
789 }, | |
790 }, | |
791 } | |
792 x := &AggregateResult{ | |
793 BuilderInfo: &BuilderInfo{ | |
794 BuildNumbers: []Number{3, 2}, | |
795 Tests: AggregateTest{ | |
796 "001.html": &AggregateTestLeaf{ | |
797 Results: []ResultSummar y{{2, "F"}}, | |
798 Runtimes: []RuntimeSumma ry{{2, 0}}, | |
799 }, | |
800 }, | |
801 }, | |
802 } | |
803 expected := &AggregateResult{ | |
804 Version: ResultsVersion, | |
805 BuilderInfo: &BuilderInfo{ | |
806 FailureMap: FailureLongNames, | |
807 BuildNumbers: []Number{3, 2, 2, 1}, | |
808 Tests: AggregateTest{ | |
809 "001.html": &AggregateTestLeaf{ | |
810 Results: []ResultSummar y{{7, "F"}}, | |
811 Runtimes: []RuntimeSumma ry{{7, 0}}, | |
812 }, | |
813 }, | |
814 }, | |
815 } | |
816 So(aggr.Merge(x), ShouldBeNil) | |
817 So(aggr, ShouldResemble, expected) | |
818 }) | |
819 | |
820 Convey("remove_new_test", func() { | |
821 aggr := &AggregateResult{ | |
822 BuilderInfo: &BuilderInfo{ | |
823 BuildNumbers: []Number{2, 1}, | |
824 Tests: AggregateTest{ | |
825 "001.html": &AggregateTestLeaf{ | |
826 Results: []ResultSummar y{{199, "F"}}, | |
827 Runtimes: []RuntimeSumma ry{{199, 0}}, | |
828 }, | |
829 }, | |
830 }, | |
831 } | |
832 x := &AggregateResult{ | |
833 BuilderInfo: &BuilderInfo{ | |
834 BuildNumbers: []Number{3}, | |
835 Tests: AggregateTest{ | |
836 "001.html": &AggregateTestLeaf{ | |
837 Results: []ResultSummar y{{1, "F"}}, | |
838 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
839 }, | |
840 "002.html": &AggregateTestLeaf{ | |
841 Results: []ResultSummar y{{1, "P"}}, | |
842 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
843 }, | |
844 "notrun.html": &AggregateTestLea f{ | |
845 Results: []ResultSummar y{{1, "Y"}}, | |
846 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
847 }, | |
848 "003.html": &AggregateTestLeaf{ | |
849 Results: []ResultSummar y{{1, "N"}}, | |
850 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
851 }, | |
852 }, | |
853 }, | |
854 } | |
855 expected := &AggregateResult{ | |
856 Version: ResultsVersion, | |
857 BuilderInfo: &BuilderInfo{ | |
858 FailureMap: FailureLongNames, | |
859 BuildNumbers: []Number{3, 2, 1}, | |
860 Tests: AggregateTest{ | |
861 "001.html": &AggregateTestLeaf{ | |
862 Results: []ResultSummar y{{200, "F"}}, | |
863 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
864 }, | |
865 }, | |
866 }, | |
867 } | |
868 So(aggr.Merge(x), ShouldBeNil) | |
869 So(aggr.Trim(200), ShouldBeNil) | |
870 So(aggr, ShouldResemble, expected) | |
871 }) | |
872 | |
873 Convey("remove_test", func() { | |
874 aggr := &AggregateResult{ | |
875 BuilderInfo: &BuilderInfo{ | |
876 BuildNumbers: []Number{2, 1}, | |
877 Tests: AggregateTest{ | |
878 "directory": AggregateTest{ | |
879 "directory": AggregateTe st{ | |
880 "001.html": &Agg regateTestLeaf{ | |
881 Results: []ResultSummary{{200, "P"}}, | |
882 Runtimes : []RuntimeSummary{{200, 0}}, | |
883 }, | |
884 }, | |
885 }, | |
886 "002.html": &AggregateTestLeaf{ | |
887 Results: []ResultSummar y{{10, "F"}}, | |
888 Runtimes: []RuntimeSumma ry{{10, 0}}, | |
889 }, | |
890 "003.html": &AggregateTestLeaf{ | |
891 Results: []ResultSummar y{{190, "P"}, {9, "N"}, {1, "F"}}, | |
892 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
893 }, | |
894 }, | |
895 }, | |
896 } | |
897 x := &AggregateResult{ | |
898 BuilderInfo: &BuilderInfo{ | |
899 BuildNumbers: []Number{3}, | |
900 Tests: AggregateTest{ | |
901 "directory": AggregateTest{ | |
902 "directory": AggregateTe st{ | |
903 "001.html": &Agg regateTestLeaf{ | |
904 Results: []ResultSummary{{1, "P"}}, | |
905 Runtimes : []RuntimeSummary{{1, 0}}, | |
906 }, | |
907 }, | |
908 }, | |
909 "002.html": &AggregateTestLeaf{ | |
910 Results: []ResultSummar y{{1, "P"}}, | |
911 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
912 }, | |
913 "003.html": &AggregateTestLeaf{ | |
914 Results: []ResultSummar y{{1, "P"}}, | |
915 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
916 }, | |
917 }, | |
918 }, | |
919 } | |
920 expected := &AggregateResult{ | |
921 Version: ResultsVersion, | |
922 BuilderInfo: &BuilderInfo{ | |
923 FailureMap: FailureLongNames, | |
924 BuildNumbers: []Number{3, 2, 1}, | |
925 Tests: AggregateTest{ | |
926 "002.html": &AggregateTestLeaf{ | |
927 Results: []ResultSummar y{{1, "P"}, {10, "F"}}, | |
928 Runtimes: []RuntimeSumma ry{{11, 0}}, | |
929 }, | |
930 }, | |
931 }, | |
932 } | |
933 So(aggr.Merge(x), ShouldBeNil) | |
934 So(aggr.Trim(200), ShouldBeNil) | |
935 So(aggr, ShouldResemble, expected) | |
936 }) | |
937 | |
938 Convey("updates_expected", func() { | |
939 aggr := &AggregateResult{ | |
940 BuilderInfo: &BuilderInfo{ | |
941 BuildNumbers: []Number{2, 1}, | |
942 Tests: AggregateTest{ | |
943 "directory": AggregateTest{ | |
944 "directory": AggregateTe st{ | |
945 "001.html": &Agg regateTestLeaf{ | |
946 Expected : []string{"FAIL"}, | |
947 Results: []ResultSummary{{200, "P"}}, | |
948 Runtimes : []RuntimeSummary{{200, 0}}, | |
949 }, | |
950 }, | |
951 }, | |
952 "002.html": &AggregateTestLeaf{ | |
953 Bugs: []string{"crbu g.com/1234"}, | |
954 Expected: []string{"FAIL "}, | |
955 Results: []ResultSummar y{{10, "F"}}, | |
956 Runtimes: []RuntimeSumma ry{{10, 0}}, | |
957 }, | |
958 "003.html": &AggregateTestLeaf{ | |
959 Expected: []string{"FAIL "}, | |
960 Results: []ResultSummar y{{190, "P"}, {9, "N"}, {1, "F"}}, | |
961 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
962 }, | |
963 "004.html": &AggregateTestLeaf{ | |
964 Results: []ResultSummar y{{199, "P"}, {1, "F"}}, | |
965 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
966 }, | |
967 }, | |
968 }, | |
969 } | |
970 x := &AggregateResult{ | |
971 BuilderInfo: &BuilderInfo{ | |
972 BuildNumbers: []Number{3}, | |
973 Tests: AggregateTest{ | |
974 "002.html": &AggregateTestLeaf{ | |
975 Expected: []string{"PASS "}, | |
976 Results: []ResultSummar y{{1, "P"}}, | |
977 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
978 }, | |
979 "003.html": &AggregateTestLeaf{ | |
980 Expected: []string{"TIME OUT"}, | |
981 Results: []ResultSummar y{{1, "P"}}, | |
982 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
983 }, | |
984 "004.html": &AggregateTestLeaf{ | |
985 Bugs: []string{"crbu g.com/1234"}, | |
986 Results: []ResultSummar y{{1, "P"}}, | |
987 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
988 }, | |
989 }, | |
990 }, | |
991 } | |
992 expected := &AggregateResult{ | |
993 Version: ResultsVersion, | |
994 BuilderInfo: &BuilderInfo{ | |
995 FailureMap: FailureLongNames, | |
996 BuildNumbers: []Number{3, 2, 1}, | |
997 Tests: AggregateTest{ | |
998 "002.html": &AggregateTestLeaf{ | |
999 Results: []ResultSummar y{{1, "P"}, {10, "F"}}, | |
1000 Runtimes: []RuntimeSumma ry{{11, 0}}, | |
1001 }, | |
1002 "003.html": &AggregateTestLeaf{ | |
1003 Expected: []string{"TIME OUT"}, | |
1004 Results: []ResultSummar y{{191, "P"}, {9, "N"}}, | |
1005 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
1006 }, | |
1007 "004.html": &AggregateTestLeaf{ | |
1008 Bugs: []string{"crbu g.com/1234"}, | |
1009 Results: []ResultSummar y{{200, "P"}}, | |
1010 Runtimes: []RuntimeSumma ry{{200, 0}}, | |
1011 }, | |
1012 }, | |
1013 }, | |
1014 } | |
1015 So(aggr.Merge(x), ShouldBeNil) | |
1016 So(aggr.Trim(200), ShouldBeNil) | |
1017 So(aggr, ShouldResemble, expected) | |
1018 }) | |
1019 | |
1020 Convey("keep_test_with_all_pass_but_slow_time", func() { | |
1021 aggr := &AggregateResult{ | |
1022 BuilderInfo: &BuilderInfo{ | |
1023 BuildNumbers: []Number{2, 1}, | |
1024 Tests: AggregateTest{ | |
1025 "001.html": &AggregateTestLeaf{ | |
1026 Results: []ResultSummar y{{200, "P"}}, | |
1027 Runtimes: []RuntimeSumma ry{{200, runtimeThresholdNormal}}, | |
1028 }, | |
1029 "002.html": &AggregateTestLeaf{ | |
1030 Results: []ResultSummar y{{10, "F"}}, | |
1031 Runtimes: []RuntimeSumma ry{{10, 0}}, | |
1032 }, | |
1033 }, | |
1034 }, | |
1035 } | |
1036 x := &AggregateResult{ | |
1037 BuilderInfo: &BuilderInfo{ | |
1038 BuildNumbers: []Number{3}, | |
1039 Tests: AggregateTest{ | |
1040 "001.html": &AggregateTestLeaf{ | |
1041 Results: []ResultSummar y{{1, "P"}}, | |
1042 Runtimes: []RuntimeSumma ry{{1, 1}}, | |
1043 }, | |
1044 "002.html": &AggregateTestLeaf{ | |
1045 Results: []ResultSummar y{{1, "P"}}, | |
1046 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
1047 }, | |
1048 }, | |
1049 }, | |
1050 } | |
1051 expected := &AggregateResult{ | |
1052 Version: ResultsVersion, | |
1053 BuilderInfo: &BuilderInfo{ | |
1054 FailureMap: FailureLongNames, | |
1055 BuildNumbers: []Number{3, 2, 1}, | |
1056 Tests: AggregateTest{ | |
1057 "001.html": &AggregateTestLeaf{ | |
1058 Results: []ResultSummar y{{201, "P"}}, | |
1059 Runtimes: []RuntimeSumma ry{{1, 1}, {200, runtimeThresholdNormal}}, | |
1060 }, | |
1061 "002.html": &AggregateTestLeaf{ | |
1062 Results: []ResultSummar y{{1, "P"}, {10, "F"}}, | |
1063 Runtimes: []RuntimeSumma ry{{11, 0}}, | |
1064 }, | |
1065 }, | |
1066 }, | |
1067 } | |
1068 So(aggr.Merge(x), ShouldBeNil) | |
1069 So(aggr, ShouldResemble, expected) | |
1070 }) | |
1071 | |
1072 Convey("pruning_slow_tests_for_debug_builders", func() { | |
1073 aggr := &AggregateResult{ | |
1074 Builder: "MockBuilder(dbg)", | |
1075 BuilderInfo: &BuilderInfo{ | |
1076 BuildNumbers: []Number{2, 1}, | |
1077 Tests: AggregateTest{ | |
1078 "001.html": &AggregateTestLeaf{ | |
1079 Results: []ResultSummar y{{200, "P"}}, | |
1080 Runtimes: []RuntimeSumma ry{{200, runtimeThresholdDebug}}, | |
1081 }, | |
1082 "002.html": &AggregateTestLeaf{ | |
1083 Results: []ResultSummar y{{10, "F"}}, | |
1084 Runtimes: []RuntimeSumma ry{{10, 0}}, | |
1085 }, | |
1086 }, | |
1087 }, | |
1088 } | |
1089 x := &AggregateResult{ | |
1090 Builder: "MockBuilder(dbg)", | |
1091 BuilderInfo: &BuilderInfo{ | |
1092 BuildNumbers: []Number{3}, | |
1093 Tests: AggregateTest{ | |
1094 "001.html": &AggregateTestLeaf{ | |
1095 Results: []ResultSummar y{{1, "P"}}, | |
1096 Runtimes: []RuntimeSumma ry{{1, 1}}, | |
1097 }, | |
1098 "002.html": &AggregateTestLeaf{ | |
1099 Results: []ResultSummar y{{1, "P"}}, | |
1100 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
1101 }, | |
1102 "003.html": &AggregateTestLeaf{ | |
1103 Results: []ResultSummar y{{1, "P"}}, | |
1104 Runtimes: []RuntimeSumma ry{{1, 3}}, | |
1105 }, | |
1106 }, | |
1107 }, | |
1108 } | |
1109 expected := &AggregateResult{ | |
1110 Version: ResultsVersion, | |
1111 Builder: "MockBuilder(dbg)", | |
1112 BuilderInfo: &BuilderInfo{ | |
1113 FailureMap: FailureLongNames, | |
1114 BuildNumbers: []Number{3, 2, 1}, | |
1115 Tests: AggregateTest{ | |
1116 "001.html": &AggregateTestLeaf{ | |
1117 Results: []ResultSummar y{{201, "P"}}, | |
1118 Runtimes: []RuntimeSumma ry{{1, 1}, {200, runtimeThresholdDebug}}, | |
1119 }, | |
1120 "002.html": &AggregateTestLeaf{ | |
1121 Results: []ResultSummar y{{1, "P"}, {10, "F"}}, | |
1122 Runtimes: []RuntimeSumma ry{{11, 0}}, | |
1123 }, | |
1124 }, | |
1125 }, | |
1126 } | |
1127 So(aggr.Merge(x), ShouldBeNil) | |
1128 So(aggr.Trim(ResultsSize), ShouldBeNil) | |
1129 So(aggr, ShouldResemble, expected) | |
1130 }) | |
1131 | |
1132 Convey("prune_extra_results", func() { | |
1133 size := ResultsSize | |
1134 aggr := &AggregateResult{ | |
1135 BuilderInfo: &BuilderInfo{ | |
1136 BuildNumbers: []Number{2, 1}, | |
1137 Tests: AggregateTest{ | |
1138 "001.html": &AggregateTestLeaf{ | |
1139 Results: []ResultSummar y{{size, "F"}, {1, "I"}}, | |
1140 Runtimes: []RuntimeSumma ry{{size, 0}, {1, 1}}, | |
1141 }, | |
1142 }, | |
1143 }, | |
1144 } | |
1145 x := &AggregateResult{ | |
1146 BuilderInfo: &BuilderInfo{ | |
1147 BuildNumbers: []Number{3}, | |
1148 Tests: AggregateTest{ | |
1149 "001.html": &AggregateTestLeaf{ | |
1150 Results: []ResultSummar y{{1, "T"}}, | |
1151 Runtimes: []RuntimeSumma ry{{1, 1}}, | |
1152 }, | |
1153 }, | |
1154 }, | |
1155 } | |
1156 expected := &AggregateResult{ | |
1157 Version: ResultsVersion, | |
1158 BuilderInfo: &BuilderInfo{ | |
1159 FailureMap: FailureLongNames, | |
1160 BuildNumbers: []Number{3, 2, 1}, | |
1161 Tests: AggregateTest{ | |
1162 "001.html": &AggregateTestLeaf{ | |
1163 Results: []ResultSummar y{{1, "T"}, {size, "F"}}, | |
1164 Runtimes: []RuntimeSumma ry{{1, 1}, {size, 0}}, | |
1165 }, | |
1166 }, | |
1167 }, | |
1168 } | |
1169 So(aggr.Merge(x), ShouldBeNil) | |
1170 So(aggr.Trim(size), ShouldBeNil) | |
1171 So(aggr, ShouldResemble, expected) | |
1172 }) | |
1173 | |
1174 Convey("prune_extra_results_small", func() { | |
1175 size := ResultsSmallSize | |
1176 aggr := &AggregateResult{ | |
1177 BuilderInfo: &BuilderInfo{ | |
1178 BuildNumbers: []Number{2, 1}, | |
1179 Tests: AggregateTest{ | |
1180 "001.html": &AggregateTestLeaf{ | |
1181 Results: []ResultSummar y{{size, "F"}, {1, "I"}}, | |
1182 Runtimes: []RuntimeSumma ry{{size, 0}, {1, 1}}, | |
1183 }, | |
1184 }, | |
1185 }, | |
1186 } | |
1187 x := &AggregateResult{ | |
1188 BuilderInfo: &BuilderInfo{ | |
1189 BuildNumbers: []Number{3}, | |
1190 Tests: AggregateTest{ | |
1191 "001.html": &AggregateTestLeaf{ | |
1192 Results: []ResultSummar y{{1, "T"}}, | |
1193 Runtimes: []RuntimeSumma ry{{1, 1}}, | |
1194 }, | |
1195 }, | |
1196 }, | |
1197 } | |
1198 expected := &AggregateResult{ | |
1199 Version: ResultsVersion, | |
1200 BuilderInfo: &BuilderInfo{ | |
1201 FailureMap: FailureLongNames, | |
1202 BuildNumbers: []Number{3, 2, 1}, | |
1203 Tests: AggregateTest{ | |
1204 "001.html": &AggregateTestLeaf{ | |
1205 Results: []ResultSummar y{{1, "T"}, {size, "F"}}, | |
1206 Runtimes: []RuntimeSumma ry{{1, 1}, {size, 0}}, | |
1207 }, | |
1208 }, | |
1209 }, | |
1210 } | |
1211 So(aggr.Merge(x), ShouldBeNil) | |
1212 So(aggr.Trim(size), ShouldBeNil) | |
1213 So(aggr, ShouldResemble, expected) | |
1214 }) | |
1215 | |
1216 Convey("prune_extra_results_with_new_results_of_same_type", func () { | |
1217 size := ResultsSmallSize | |
1218 aggr := &AggregateResult{ | |
1219 BuilderInfo: &BuilderInfo{ | |
1220 BuildNumbers: []Number{2, 1}, | |
1221 Tests: AggregateTest{ | |
1222 "001.html": &AggregateTestLeaf{ | |
1223 Results: []ResultSummar y{{size, "F"}, {1, "N"}}, | |
1224 Runtimes: []RuntimeSumma ry{{size, 0}, {1, 1}}, | |
1225 }, | |
1226 }, | |
1227 }, | |
1228 } | |
1229 x := &AggregateResult{ | |
1230 BuilderInfo: &BuilderInfo{ | |
1231 BuildNumbers: []Number{3}, | |
1232 Tests: AggregateTest{ | |
1233 "001.html": &AggregateTestLeaf{ | |
1234 Results: []ResultSummar y{{1, "F"}}, | |
1235 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
1236 }, | |
1237 }, | |
1238 }, | |
1239 } | |
1240 expected := &AggregateResult{ | |
1241 Version: ResultsVersion, | |
1242 BuilderInfo: &BuilderInfo{ | |
1243 FailureMap: FailureLongNames, | |
1244 BuildNumbers: []Number{3, 2, 1}, | |
1245 Tests: AggregateTest{ | |
1246 "001.html": &AggregateTestLeaf{ | |
1247 Results: []ResultSummar y{{size, "F"}}, | |
1248 Runtimes: []RuntimeSumma ry{{size, 0}}, | |
1249 }, | |
1250 }, | |
1251 }, | |
1252 } | |
1253 So(aggr.Merge(x), ShouldBeNil) | |
1254 So(aggr.Trim(size), ShouldBeNil) | |
1255 So(aggr, ShouldResemble, expected) | |
1256 }) | |
1257 | |
1258 Convey("merge_build_directory_hierarchy", func() { | |
1259 aggr := &AggregateResult{ | |
1260 Version: ResultsVersion, | |
1261 BuilderInfo: &BuilderInfo{ | |
1262 BuildNumbers: []Number{2, 1}, | |
1263 Tests: AggregateTest{ | |
1264 "bar": AggregateTest{ | |
1265 "baz": AggregateTest{ | |
1266 "003.html": &Agg regateTestLeaf{ | |
1267 Results: []ResultSummary{{25, "F"}}, | |
1268 Runtimes : []RuntimeSummary{{25, 0}}, | |
1269 }, | |
1270 }, | |
1271 }, | |
1272 "foo": AggregateTest{ | |
1273 "001.html": &AggregateTe stLeaf{ | |
1274 Results: []Resu ltSummary{{50, "F"}}, | |
1275 Runtimes: []Runt imeSummary{{50, 0}}, | |
1276 }, | |
1277 "002.html": &AggregateTe stLeaf{ | |
1278 Results: []Resu ltSummary{{100, "I"}}, | |
1279 Runtimes: []Runt imeSummary{{100, 0}}, | |
1280 }, | |
1281 }, | |
1282 }, | |
1283 }, | |
1284 } | |
1285 x := &AggregateResult{ | |
1286 Version: ResultsVersion, | |
1287 BuilderInfo: &BuilderInfo{ | |
1288 BuildNumbers: []Number{3}, | |
1289 Tests: AggregateTest{ | |
1290 "baz": AggregateTest{ | |
1291 "004.html": &AggregateTe stLeaf{ | |
1292 Results: []Resu ltSummary{{1, "I"}}, | |
1293 Runtimes: []Runt imeSummary{{1, 0}}, | |
1294 }, | |
1295 }, | |
1296 "foo": AggregateTest{ | |
1297 "001.html": &AggregateTe stLeaf{ | |
1298 Results: []Resu ltSummary{{1, "F"}}, | |
1299 Runtimes: []Runt imeSummary{{1, 0}}, | |
1300 }, | |
1301 "002.html": &AggregateTe stLeaf{ | |
1302 Results: []Resu ltSummary{{1, "I"}}, | |
1303 Runtimes: []Runt imeSummary{{1, 0}}, | |
1304 }, | |
1305 }, | |
1306 }, | |
1307 }, | |
1308 } | |
1309 expected := &AggregateResult{ | |
1310 Version: ResultsVersion, | |
1311 BuilderInfo: &BuilderInfo{ | |
1312 FailureMap: FailureLongNames, | |
1313 BuildNumbers: []Number{3, 2, 1}, | |
1314 Tests: AggregateTest{ | |
1315 "bar": AggregateTest{ | |
1316 "baz": AggregateTest{ | |
1317 "003.html": &Agg regateTestLeaf{ | |
1318 Results: []ResultSummary{{1, "N"}, {25, "F"}}, | |
1319 Runtimes : []RuntimeSummary{{26, 0}}, | |
1320 }, | |
1321 }, | |
1322 }, | |
1323 "baz": AggregateTest{ | |
1324 "004.html": &AggregateTe stLeaf{ | |
1325 Results: []Resu ltSummary{{1, "I"}}, | |
1326 Runtimes: []Runt imeSummary{{1, 0}}, | |
1327 }, | |
1328 }, | |
1329 "foo": AggregateTest{ | |
1330 "001.html": &AggregateTe stLeaf{ | |
1331 Results: []Resu ltSummary{{51, "F"}}, | |
1332 Runtimes: []Runt imeSummary{{51, 0}}, | |
1333 }, | |
1334 "002.html": &AggregateTe stLeaf{ | |
1335 Results: []Resu ltSummary{{101, "I"}}, | |
1336 Runtimes: []Runt imeSummary{{101, 0}}, | |
1337 }, | |
1338 }, | |
1339 }, | |
1340 }, | |
1341 } | |
1342 So(aggr.Merge(x), ShouldBeNil) | |
1343 So(aggr.Trim(math.MaxInt64), ShouldBeNil) | |
1344 So(aggr, ShouldResemble, expected) | |
1345 }) | |
1346 | |
1347 Convey("treats_multiple_results_as_a_unique_type", func() { | |
1348 aggr := &AggregateResult{ | |
1349 BuilderInfo: &BuilderInfo{ | |
1350 BuildNumbers: []Number{3, 1}, | |
1351 Tests: AggregateTest{ | |
1352 "001.html": &AggregateTestLeaf{ | |
1353 Results: []ResultSummar y{{5, "F"}}, | |
1354 Runtimes: []RuntimeSumma ry{{5, 0}}, | |
1355 }, | |
1356 "002.html": &AggregateTestLeaf{ | |
1357 Results: []ResultSummar y{{3, "FQ"}}, | |
1358 Runtimes: []RuntimeSumma ry{{3, 0}}, | |
1359 }, | |
1360 }, | |
1361 }, | |
1362 } | |
1363 x := &AggregateResult{ | |
1364 BuilderInfo: &BuilderInfo{ | |
1365 BuildNumbers: []Number{2}, | |
1366 Tests: AggregateTest{ | |
1367 "001.html": &AggregateTestLeaf{ | |
1368 Results: []ResultSummar y{{1, "FIQ"}}, | |
1369 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
1370 }, | |
1371 "002.html": &AggregateTestLeaf{ | |
1372 Results: []ResultSummar y{{1, "FQ"}}, | |
1373 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
1374 }, | |
1375 }, | |
1376 }, | |
1377 } | |
1378 expected := &AggregateResult{ | |
1379 Version: ResultsVersion, | |
1380 BuilderInfo: &BuilderInfo{ | |
1381 FailureMap: FailureLongNames, | |
1382 BuildNumbers: []Number{2, 3, 1}, | |
1383 Tests: AggregateTest{ | |
1384 "001.html": &AggregateTestLeaf{ | |
1385 Results: []ResultSummar y{{1, "FIQ"}, {5, "F"}}, | |
1386 Runtimes: []RuntimeSumma ry{{6, 0}}, | |
1387 }, | |
1388 "002.html": &AggregateTestLeaf{ | |
1389 Results: []ResultSummar y{{4, "FQ"}}, | |
1390 Runtimes: []RuntimeSumma ry{{4, 0}}, | |
1391 }, | |
1392 }, | |
1393 }, | |
1394 } | |
1395 So(aggr.Merge(x), ShouldBeNil) | |
1396 So(aggr.Trim(math.MaxInt64), ShouldBeNil) | |
1397 So(aggr, ShouldResemble, expected) | |
1398 }) | |
1399 | |
1400 Convey("gtest", func() { | |
1401 aggr := &AggregateResult{ | |
1402 BuilderInfo: &BuilderInfo{ | |
1403 BuildNumbers: []Number{2, 1}, | |
1404 Tests: AggregateTest{ | |
1405 "foo.bar": &AggregateTestLeaf{ | |
1406 Results: []ResultSummar y{{50, "F"}}, | |
1407 Runtimes: []RuntimeSumma ry{{50, 0}}, | |
1408 }, | |
1409 "foo.bar2": &AggregateTestLeaf{ | |
1410 Results: []ResultSummar y{{100, "I"}}, | |
1411 Runtimes: []RuntimeSumma ry{{100, 0}}, | |
1412 }, | |
1413 "test.failed": &AggregateTestLea f{ | |
1414 Results: []ResultSummar y{{5, "Q"}}, | |
1415 Runtimes: []RuntimeSumma ry{{5, 0}}, | |
1416 }, | |
1417 }, | |
1418 }, | |
1419 } | |
1420 x := &AggregateResult{ | |
1421 BuilderInfo: &BuilderInfo{ | |
1422 BuildNumbers: []Number{3}, | |
1423 Tests: AggregateTest{ | |
1424 "foo.bar2": &AggregateTestLeaf{ | |
1425 Results: []ResultSummar y{{1, "I"}}, | |
1426 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
1427 }, | |
1428 "foo.bar3": &AggregateTestLeaf{ | |
1429 Results: []ResultSummar y{{1, "F"}}, | |
1430 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
1431 }, | |
1432 "test.failed": &AggregateTestLea f{ | |
1433 Results: []ResultSummar y{{5, "Q"}}, | |
1434 Runtimes: []RuntimeSumma ry{{5, 0}}, | |
1435 }, | |
1436 }, | |
1437 }, | |
1438 } | |
1439 expected := &AggregateResult{ | |
1440 Version: ResultsVersion, | |
1441 BuilderInfo: &BuilderInfo{ | |
1442 FailureMap: FailureLongNames, | |
1443 BuildNumbers: []Number{3, 2, 1}, | |
1444 Tests: AggregateTest{ | |
1445 "foo.bar": &AggregateTestLeaf{ | |
1446 Results: []ResultSummar y{{1, "N"}, {50, "F"}}, | |
1447 Runtimes: []RuntimeSumma ry{{51, 0}}, | |
1448 }, | |
1449 "foo.bar2": &AggregateTestLeaf{ | |
1450 Results: []ResultSummar y{{101, "I"}}, | |
1451 Runtimes: []RuntimeSumma ry{{101, 0}}, | |
1452 }, | |
1453 "foo.bar3": &AggregateTestLeaf{ | |
1454 Results: []ResultSummar y{{1, "F"}}, | |
1455 Runtimes: []RuntimeSumma ry{{1, 0}}, | |
1456 }, | |
1457 "test.failed": &AggregateTestLea f{ | |
1458 Results: []ResultSummar y{{10, "Q"}}, | |
1459 Runtimes: []RuntimeSumma ry{{10, 0}}, | |
1460 }, | |
1461 }, | |
1462 }, | |
1463 } | |
1464 So(aggr.Merge(x), ShouldBeNil) | |
1465 So(aggr.Trim(math.MaxInt64), ShouldBeNil) | |
1466 So(aggr, ShouldResemble, expected) | |
1467 }) | |
1468 }) | |
1469 } | |
OLD | NEW |