Chromium Code Reviews| Index: go/src/infra/appengine/test-results/model/end_to_end_test.go |
| diff --git a/go/src/infra/appengine/test-results/model/end_to_end_test.go b/go/src/infra/appengine/test-results/model/end_to_end_test.go |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f2dc39f7f11a58ddbab1437b32e2c9717b63bdcb |
| --- /dev/null |
| +++ b/go/src/infra/appengine/test-results/model/end_to_end_test.go |
| @@ -0,0 +1,117 @@ |
| +package model |
| + |
| +import ( |
| + "bytes" |
| + "encoding/json" |
| + "io/ioutil" |
| + "path/filepath" |
| + "testing" |
| + |
| + . "github.com/smartystreets/goconvey/convey" |
| +) |
| + |
| +func TestEndToEnd(t *testing.T) { |
| + t.Parallel() |
| + |
| + Convey("End to end", t, func() { |
| + Convey("FullResult: clean, unmarshal JSON, merge, trim", func() { |
| + b, err := ioutil.ReadFile(filepath.Join("testdata", "full_results_callback.json")) |
| + So(err, ShouldBeNil) |
| + r, err := CleanJSON(bytes.NewReader(bytes.TrimSpace(b))) |
| + So(err, ShouldBeNil) |
| + |
| + expected := &AggregateResult{ |
| + Builder: "Webkit", |
| + Version: ResultsVersion, |
| + BuilderInfo: &BuilderInfo{ |
| + BuildNumbers: []Number{3}, |
| + ChromeRevs: []string{"5678"}, |
| + FailureMap: FailureLongNames, |
| + FailuresByType: map[string][]int{ |
| + "AUDIO": {0}, |
| + "CRASH": {3}, |
| + "FAIL": {2}, |
| + "IMAGE": {1}, |
| + "IMAGE+TEXT": {0}, |
| + "MISSING": {0}, |
| + "PASS": {10}, |
| + "SKIP": {2}, |
| + "TEXT": {3}, |
| + "TIMEOUT": {16}, |
| + "LEAK": {1}, |
| + }, |
| + SecondsEpoch: []int64{1368146629}, |
| + Tests: AggregateTest{ |
| + "media": AggregateTest{ |
| + "W3C": AggregateTest{ |
| + "audio": AggregateTest{ |
|
martiniss
2016/08/12 00:14:24
Just to confirm, the W3C video src tests in the te
nishanths
2016/08/12 02:37:39
Yes, added comment. Also added comment that is a p
|
| + "src": AggregateTest{ |
| + "src_removal_does_not_trigger_loadstart.html": &AggregateTestLeaf{ |
| + Results: []ResultSummary{{1, "P"}}, |
| + Runtimes: []RuntimeSummary{{1, 4}}, |
| + }, |
| + }, |
| + }, |
| + }, |
| + "encrypted-media": AggregateTest{ |
| + "random-test-1.html": &AggregateTestLeaf{ |
| + Bugs: []string{"crbug.com/1234"}, |
| + Results: []ResultSummary{{1, "T"}}, |
| + Runtimes: []RuntimeSummary{{1, 6}}, |
| + Expected: []string{"TIMEOUT"}, |
| + }, |
| + "random-test-2.html": &AggregateTestLeaf{ |
| + Expected: []string{"TIMEOUT"}, |
| + Results: []ResultSummary{{1, "T"}}, |
| + Runtimes: []RuntimeSummary{{1, 0}}, |
| + }, |
| + }, |
| + "media-document-audio-repaint.html": &AggregateTestLeaf{ |
| + Expected: []string{"IMAGE"}, |
| + Results: []ResultSummary{{1, "I"}}, |
| + Runtimes: []RuntimeSummary{{1, 0}}, |
| + }, |
| + "progress-events-generated-correctly.html": &AggregateTestLeaf{ |
| + Expected: []string{"PASS", "FAIL", "IMAGE", "TIMEOUT", "CRASH", "MISSING"}, |
| + Results: []ResultSummary{{1, "T"}}, |
| + Runtimes: []RuntimeSummary{{1, 6}}, |
| + }, |
| + "flaky-failed.html": &AggregateTestLeaf{ |
| + Expected: []string{"PASS", "FAIL"}, |
| + Results: []ResultSummary{{1, "Q"}}, |
| + Runtimes: []RuntimeSummary{{1, 0}}, |
| + }, |
| + "unexpected-fail.html": &AggregateTestLeaf{ |
| + Results: []ResultSummary{{1, "Q"}}, |
| + Runtimes: []RuntimeSummary{{1, 0}}, |
| + }, |
| + "unexpected-leak.html": &AggregateTestLeaf{ |
| + Results: []ResultSummary{{1, "K"}}, |
| + Runtimes: []RuntimeSummary{{1, 0}}, |
| + }, |
| + "unexpected-flake.html": &AggregateTestLeaf{ |
| + Results: []ResultSummary{{1, "QP"}}, |
| + Runtimes: []RuntimeSummary{{1, 0}}, |
| + }, |
| + "unexpected-unexpected.html": &AggregateTestLeaf{ |
| + Results: []ResultSummary{{1, "U"}}, |
| + Runtimes: []RuntimeSummary{{1, 0}}, |
| + }, |
| + }, |
| + }, |
| + }, |
| + } |
| + |
| + var aggr AggregateResult |
| + aggr.Builder = "Webkit" |
| + var x FullResult |
|
martiniss
2016/08/12 00:14:24
nit: "var result FullResult"?
nishanths
2016/08/12 02:37:39
Done.
|
| + |
| + So(json.NewDecoder(r).Decode(&x), ShouldBeNil) |
| + y, err := x.AggregateResult() |
| + So(err, ShouldBeNil) |
| + So(aggr.Merge(&y), ShouldBeNil) |
| + So(aggr.Trim(ResultsSize), ShouldBeNil) |
| + So(&aggr, ShouldResemble, expected) |
| + }) |
| + }) |
| +} |