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

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

Issue 2234353002: test-results: package model: Add full_result.go and tests (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: 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
(Empty)
1 package model
2
3 import (
4 "encoding/json"
5 "testing"
6
7 . "github.com/smartystreets/goconvey/convey"
8 )
9
10 func TestFullResult(t *testing.T) {
11 t.Parallel()
12
13 Convey("TestFullResult", t, func() {
14 runtime := 20.9
15 unexpected := true
16
17 leaf := FullTestLeaf{
18 Actual: []string{"PASS", "AUDIO", "CRASH"},
19 Expected: []string{"PASS", "CRASH"},
20 Runtime: &runtime,
21 Bugs: []string{"crbug.com/700", "crbug.com/900"},
22 Unexpected: &unexpected,
23 }
24
25 ft := FullTest{
26 "foo": &FullTestLeaf{
27 Actual: []string{"FLAKY"},
28 Expected: []string{"FLAKY"},
29 },
30 "bar": &FullTestLeaf{
31 Actual: []string{"IMAGE"},
32 Expected: []string{"CRASH"},
33 },
34 "baz": FullTest{
35 "qux": FullTest{
36 "baaz": &FullTestLeaf{
37 Actual: []string{"CRASH"},
38 Expected: []string{"CRASH", "AUD IO"},
39 },
40 },
41 "baax": &leaf,
42 },
43 }
44
45 chromiumrev := "45000"
46
47 fr := FullResult{
48 Version: 4,
49 Builder: "foo_builder",
50 BuildNumber: Number(1000),
51 SecondsEpoch: 6400000000,
52 Tests: ft,
53 FailuresByType: map[string]int{
54 "A": 5,
55 "Q": 11,
56 },
57 ChromiumRev: &chromiumrev,
58 }
59
60 Convey("FullTestLeaf", func() {
61 Convey("Marshal followed by unmarshal returns original", func() {
62 b, err := json.Marshal(&leaf)
63 So(err, ShouldBeNil)
64 var actual FullTestLeaf
65 So(json.Unmarshal(b, &actual), ShouldBeNil)
66 So(actual, ShouldResemble, leaf)
67 })
68 })
69
70 Convey("FullTest", func() {
71 Convey("Marshal followed by unmarshal returns original", func() {
72 b, err := json.Marshal(&ft)
73 So(err, ShouldBeNil)
74 var actual FullTest
75 So(json.Unmarshal(b, &actual), ShouldBeNil)
76 So(actual, ShouldResemble, ft)
77 })
78 })
79
80 Convey("FullResult", func() {
81 Convey("Marshal followed by unmarshal returns original", func() {
82 b, err := json.Marshal(&fr)
83 So(err, ShouldBeNil)
84 var actual FullResult
85 So(json.Unmarshal(b, &actual), ShouldBeNil)
86 So(actual, ShouldResemble, fr)
87 })
88 })
89 })
90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698