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

Side by Side Diff: go/src/infra/appengine/test-results/model/aggregate_result_test.go

Issue 2252623002: test-results: package model: Add type TestList (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@cl-ing_upload
Patch Set: Fix renamed function call Created 4 years, 4 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 package model 1 package model
2 2
3 import ( 3 import (
4 "bytes" 4 "bytes"
5 "encoding/json" 5 "encoding/json"
6 "io/ioutil" 6 "io/ioutil"
7 "math" 7 "math"
8 "path/filepath" 8 "path/filepath"
9 "testing" 9 "testing"
10 10
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 "FAIL": {1, 2}, 375 "FAIL": {1, 2},
376 "AUDIO": {100}, 376 "AUDIO": {100},
377 }) 377 })
378 }) 378 })
379 }) 379 })
380 }) 380 })
381 381
382 Convey("Testing with testdata/*.json", func() { 382 Convey("Testing with testdata/*.json", func() {
383 good, err := ioutil.ReadFile(filepath.Join("test data", "results.json")) 383 good, err := ioutil.ReadFile(filepath.Join("test data", "results.json"))
384 So(err, ShouldBeNil) 384 So(err, ShouldBeNil)
385 t := AggregateResult{}
386 So(json.Unmarshal(good, &t), ShouldBeNil)
385 387
386 » » » » Convey("Absent builder", func() { 388 » » » » Convey("Has correct version", func() {
387 » » » » » t := AggregateResult{Builder: "non_exist ent_builder"} 389 » » » » » So(t.Version, ShouldEqual, 4)
388 » » » » » So(json.Unmarshal(good, &t), ShouldNotBe Nil)
389 }) 390 })
390 391
391 » » » » Convey("Existing builder", func() { 392 » » » » Convey("Marshal and Unmarshal should be inverse ops", func() {
392 » » » » » t := AggregateResult{Builder: "win_chrom ium_rel_ng"} 393 » » » » » var (
393 » » » » » So(json.Unmarshal(good, &t), ShouldBeNil ) 394 » » » » » » repeater = AggregateResult{Build er: "win_chromium_rel_ng"}
395 » » » » » » actual = AggregateResult{Build er: "win_chromium_rel_ng"}
396 » » » » » )
394 397
395 » » » » » Convey("Has correct version", func() { 398 » » » » » So(json.Unmarshal(good, &repeater), Shou ldBeNil)
396 » » » » » » So(t.Version, ShouldEqual, 4) 399 » » » » » b, err := json.Marshal(&repeater)
397 » » » » » }) 400 » » » » » So(err, ShouldBeNil)
398 401
399 » » » » » Convey("Marshal and Unmarshal should be inverse ops", func() { 402 » » » » » So(json.Unmarshal(b, &actual), ShouldBeN il)
400 » » » » » » var ( 403 » » » » » So(actual, ShouldResemble, t)
401 » » » » » » » repeater = AggregateResu lt{Builder: "win_chromium_rel_ng"}
402 » » » » » » » actual = AggregateResu lt{Builder: "win_chromium_rel_ng"}
403 » » » » » » )
404
405 » » » » » » So(json.Unmarshal(good, &repeate r), ShouldBeNil)
406 » » » » » » b, err := json.Marshal(&repeater )
407 » » » » » » So(err, ShouldBeNil)
408
409 » » » » » » So(json.Unmarshal(b, &actual), S houldBeNil)
410 » » » » » » So(actual, ShouldResemble, t)
411 » » » » » })
412 }) 404 })
413 }) 405 })
414 }) 406 })
415 }) 407 })
416 } 408 }
417 409
418 func TestMerge(t *testing.T) { 410 func TestMerge(t *testing.T) {
419 t.Parallel() 411 t.Parallel()
420 412
421 Convey("Merge", t, func() { 413 Convey("Merge", t, func() {
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 }, 1859 },
1868 }, 1860 },
1869 }, 1861 },
1870 } 1862 }
1871 So(aggr.Merge(x), ShouldBeNil) 1863 So(aggr.Merge(x), ShouldBeNil)
1872 So(aggr.Trim(math.MaxInt64), ShouldBeNil) 1864 So(aggr.Trim(math.MaxInt64), ShouldBeNil)
1873 So(aggr, ShouldResemble, expected) 1865 So(aggr, ShouldResemble, expected)
1874 }) 1866 })
1875 }) 1867 })
1876 } 1868 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698