| Index: go/src/infra/appengine/test-results/model/full_result_test.go
|
| diff --git a/go/src/infra/appengine/test-results/model/full_result_test.go b/go/src/infra/appengine/test-results/model/full_result_test.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..51d3c4c83bf6a20b3a2f74b05e5d8351a9a649fc
|
| --- /dev/null
|
| +++ b/go/src/infra/appengine/test-results/model/full_result_test.go
|
| @@ -0,0 +1,90 @@
|
| +package model
|
| +
|
| +import (
|
| + "encoding/json"
|
| + "testing"
|
| +
|
| + . "github.com/smartystreets/goconvey/convey"
|
| +)
|
| +
|
| +func TestFullResult(t *testing.T) {
|
| + t.Parallel()
|
| +
|
| + Convey("TestFullResult", t, func() {
|
| + runtime := 20.9
|
| + unexpected := true
|
| +
|
| + leaf := FullTestLeaf{
|
| + Actual: []string{"PASS", "AUDIO", "CRASH"},
|
| + Expected: []string{"PASS", "CRASH"},
|
| + Runtime: &runtime,
|
| + Bugs: []string{"crbug.com/700", "crbug.com/900"},
|
| + Unexpected: &unexpected,
|
| + }
|
| +
|
| + ft := FullTest{
|
| + "foo": &FullTestLeaf{
|
| + Actual: []string{"FLAKY"},
|
| + Expected: []string{"FLAKY"},
|
| + },
|
| + "bar": &FullTestLeaf{
|
| + Actual: []string{"IMAGE"},
|
| + Expected: []string{"CRASH"},
|
| + },
|
| + "baz": FullTest{
|
| + "qux": FullTest{
|
| + "baaz": &FullTestLeaf{
|
| + Actual: []string{"CRASH"},
|
| + Expected: []string{"CRASH", "AUDIO"},
|
| + },
|
| + },
|
| + "baax": &leaf,
|
| + },
|
| + }
|
| +
|
| + chromiumrev := "45000"
|
| +
|
| + fr := FullResult{
|
| + Version: 4,
|
| + Builder: "foo_builder",
|
| + BuildNumber: Number(1000),
|
| + SecondsEpoch: 6400000000,
|
| + Tests: ft,
|
| + FailuresByType: map[string]int{
|
| + "A": 5,
|
| + "Q": 11,
|
| + },
|
| + ChromiumRev: &chromiumrev,
|
| + }
|
| +
|
| + Convey("FullTestLeaf", func() {
|
| + Convey("Marshal followed by unmarshal returns original", func() {
|
| + b, err := json.Marshal(&leaf)
|
| + So(err, ShouldBeNil)
|
| + var actual FullTestLeaf
|
| + So(json.Unmarshal(b, &actual), ShouldBeNil)
|
| + So(actual, ShouldResemble, leaf)
|
| + })
|
| + })
|
| +
|
| + Convey("FullTest", func() {
|
| + Convey("Marshal followed by unmarshal returns original", func() {
|
| + b, err := json.Marshal(&ft)
|
| + So(err, ShouldBeNil)
|
| + var actual FullTest
|
| + So(json.Unmarshal(b, &actual), ShouldBeNil)
|
| + So(actual, ShouldResemble, ft)
|
| + })
|
| + })
|
| +
|
| + Convey("FullResult", func() {
|
| + Convey("Marshal followed by unmarshal returns original", func() {
|
| + b, err := json.Marshal(&fr)
|
| + So(err, ShouldBeNil)
|
| + var actual FullResult
|
| + So(json.Unmarshal(b, &actual), ShouldBeNil)
|
| + So(actual, ShouldResemble, fr)
|
| + })
|
| + })
|
| + })
|
| +}
|
|
|