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

Unified Diff: go/src/infra/appengine/test-results/model/aggregate_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: Improve coverage 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 side-by-side diff with in-line comments
Download patch
Index: go/src/infra/appengine/test-results/model/aggregate_result_test.go
diff --git a/go/src/infra/appengine/test-results/model/aggregate_result_test.go b/go/src/infra/appengine/test-results/model/aggregate_result_test.go
index 811d0cbd53742618b59920e15941db1f3142b0ef..8f3c1a197ef7a0a24f6767887d5a86272c41063d 100644
--- a/go/src/infra/appengine/test-results/model/aggregate_result_test.go
+++ b/go/src/infra/appengine/test-results/model/aggregate_result_test.go
@@ -10,13 +10,13 @@ import (
. "github.com/smartystreets/goconvey/convey"
)
-func TestCleanTestResultsJSON(t *testing.T) {
- Convey("CleanTestResultsJSON", t, func() {
+func TestCleanJSON(t *testing.T) {
+ Convey("CleanJSON", t, func() {
data := `{"foo":"bar"}`
Convey("Strips prefix and suffix", func() {
r := bytes.NewReader([]byte(`ADD_RESULTS(` + data + `);`))
- res, err := CleanTestResultsJSON(r)
+ res, err := CleanJSON(r)
So(err, ShouldBeNil)
b, err := ioutil.ReadAll(res)
So(err, ShouldBeNil)
@@ -25,7 +25,7 @@ func TestCleanTestResultsJSON(t *testing.T) {
Convey("Returns original when prefix and suffix are absent", func() {
r := bytes.NewReader([]byte(data))
- res, err := CleanTestResultsJSON(r)
+ res, err := CleanJSON(r)
So(err, ShouldBeNil)
b, err := ioutil.ReadAll(res)
So(err, ShouldBeNil)
@@ -261,14 +261,6 @@ func TestAggregateResult(t *testing.T) {
So(err, ShouldNotBeNil)
})
- Convey("Wrong secondsSinceEpoch list type", func() {
- tm["foo_builder"].(map[string]interface{})["secondsSinceEpoch"] =
- nil
- b := marshal(tm)
- err := json.Unmarshal(b, &t)
- So(err, ShouldNotBeNil)
- })
-
Convey("Valid secondsSinceEpoch", func() {
b := marshal(tm)
err := json.Unmarshal(b, &t)
@@ -287,18 +279,11 @@ func TestAggregateResult(t *testing.T) {
So(err, ShouldNotBeNil)
})
- Convey("Wrong blinkRevision list type", func() {
- tm["foo_builder"].(map[string]interface{})["blinkRevision"] = nil
- b := marshal(tm)
- err := json.Unmarshal(b, &t)
- So(err, ShouldNotBeNil)
- })
-
Convey("Valid blinkRevision", func() {
b := marshal(tm)
err := json.Unmarshal(b, &t)
So(err, ShouldBeNil)
- So(t.BlinkRevs, ShouldResemble, []number{100, 200, 0, -50})
+ So(t.BlinkRevs, ShouldResemble, []Number{100, 200, 0, -50})
})
})
@@ -322,7 +307,7 @@ func TestAggregateResult(t *testing.T) {
b := marshal(tm)
err := json.Unmarshal(b, &t)
So(err, ShouldBeNil)
- So(t.BuildNumbers, ShouldResemble, []number{9000, 7500, -42, 0})
+ So(t.BuildNumbers, ShouldResemble, []Number{9000, 7500, -42, 0})
})
})
@@ -335,13 +320,6 @@ func TestAggregateResult(t *testing.T) {
So(err, ShouldNotBeNil)
})
- Convey("Wrong chromeRevision list type", func() {
- tm["foo_builder"].(map[string]interface{})["chromeRevision"] = nil
- b := marshal(tm)
- err := json.Unmarshal(b, &t)
- So(err, ShouldNotBeNil)
- })
-
Convey("Valid chromeRevision", func() {
b := marshal(tm)
err := json.Unmarshal(b, &t)
« no previous file with comments | « go/src/infra/appengine/test-results/model/aggregate_result.go ('k') | go/src/infra/appengine/test-results/model/common.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698