[gold] Remove type expectations.BaselineInt and all references.
Step 9 of the plan outlined in skbug.com/10522.
Bug: skia:10522
Change-Id: Id0c79c9fe60a8bc7724f577af1bd1d41e9ffdd9f
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/304922
Commit-Queue: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
diff --git a/gold-client/go/goldclient/goldclient_test.go b/gold-client/go/goldclient/goldclient_test.go
index 6fc2f97..027eac0 100644
--- a/gold-client/go/goldclient/goldclient_test.go
+++ b/gold-client/go/goldclient/goldclient_test.go
@@ -2402,7 +2402,7 @@
// An example baseline that has a single test at a single commit with a good
// image and a bad image.
//
-// TODO(skbug.com/10522): Remove int expectations and rename master_str to master.
+// TODO(skbug.com/10522): Rename master_str to master.
const mockBaselineJSON = `
{
"md5": "7e4081337b3258555906970002a04a59",
@@ -2412,12 +2412,6 @@
"badbadbad1325855590527db196112e0": "negative"
}
},
- "master": {
- "ThisIsTheOnlyTest": {
- "beef00d3a1527db19619ec12a4e0df68": 1,
- "badbadbad1325855590527db196112e0": 2
- }
- },
"Issue": -1
}`
diff --git a/golden/go/baseline/simple_baseliner/simple_baseliner.go b/golden/go/baseline/simple_baseliner/simple_baseliner.go
index cb916cd..4066152 100644
--- a/golden/go/baseline/simple_baseliner/simple_baseliner.go
+++ b/golden/go/baseline/simple_baseliner/simple_baseliner.go
@@ -38,9 +38,8 @@
ChangeListID: "",
CodeReviewSystem: "",
Expectations: exp.AsBaseline(),
- ExpectationsInt: exp.AsBaselineInt(),
}
- md5Sum, err := util.MD5Sum(b.ExpectationsInt)
+ md5Sum, err := util.MD5Sum(b.Expectations)
if err != nil {
return nil, skerr.Wrapf(err, "calculating md5 hash of expectations")
}
@@ -63,7 +62,6 @@
ChangeListID: clID,
CodeReviewSystem: crs,
Expectations: iexp.AsBaseline(),
- ExpectationsInt: iexp.AsBaselineInt(),
MD5: md5Sum,
}, nil
}
@@ -79,9 +77,8 @@
ChangeListID: clID,
CodeReviewSystem: crs,
Expectations: exp.AsBaseline(),
- ExpectationsInt: exp.AsBaselineInt(),
}
- md5Sum, err := util.MD5Sum(b.ExpectationsInt)
+ md5Sum, err := util.MD5Sum(b.Expectations)
if err != nil {
return nil, skerr.Wrapf(err, "calculating md5 hash of expectations")
}
diff --git a/golden/go/baseline/simple_baseliner/simple_baseliner_test.go b/golden/go/baseline/simple_baseliner/simple_baseliner_test.go
index dd5d7cc..fe13b06 100644
--- a/golden/go/baseline/simple_baseliner/simple_baseliner_test.go
+++ b/golden/go/baseline/simple_baseliner/simple_baseliner_test.go
@@ -33,10 +33,8 @@
exp := three_devices.MakeTestExpectations()
expectedBaseline := exp.AsBaseline()
- expectedBaselineInt := exp.AsBaselineInt()
assert.Equal(t, expectedBaseline, b.Expectations)
- assert.Equal(t, expectedBaselineInt, b.ExpectationsInt)
assert.Equal(t, masterBranch, b.ChangeListID)
assert.Equal(t, noCRS, b.CodeReviewSystem)
assert.NotEqual(t, "", b.MD5)
@@ -102,22 +100,6 @@
three_devices.BetaUntriagedDigest: expectations.Positive,
},
}, b.Expectations)
- assert.Equal(t, expectations.BaselineInt{
- "brand-new-test": {
- IotaNewDigest: expectations.PositiveInt,
- KappaNewDigest: expectations.NegativeInt,
- },
- // AlphaTest should be unchanged from the master baseline.
- three_devices.AlphaTest: {
- three_devices.AlphaPositiveDigest: expectations.PositiveInt,
- three_devices.AlphaNegativeDigest: expectations.NegativeInt,
- },
- three_devices.BetaTest: {
- MuNewDigest: expectations.PositiveInt,
- three_devices.BetaPositiveDigest: expectations.NegativeInt,
- three_devices.BetaUntriagedDigest: expectations.PositiveInt,
- },
- }, b.ExpectationsInt)
mes.On("GetCopy", testutils.AnyContext).Return(three_devices.MakeTestExpectations(), nil).Once()
diff --git a/golden/go/baseline/types.go b/golden/go/baseline/types.go
index 69a59bd..b22286d 100644
--- a/golden/go/baseline/types.go
+++ b/golden/go/baseline/types.go
@@ -20,12 +20,6 @@
// expectations.Label is finished.
Expectations expectations.Baseline `json:"master_str"`
- // Expectations captures the "baseline expectations", that is, the Expectations with only the
- // positive and negative digests (i.e. no untriaged digest) of the current commit.
- //
- // TODO(skbug.com/10522): Delete after expectations.LabelStr to expectations.Label is finished.
- ExpectationsInt expectations.BaselineInt `json:"master"`
-
// ChangeListID indicates the Gerrit or GitHub issue id of this baseline.
// "" indicates the master branch.
ChangeListID string `json:"cl_id,omitempty"`
diff --git a/golden/go/expectations/expectations.go b/golden/go/expectations/expectations.go
index 7f9a009..03d0c1f 100644
--- a/golden/go/expectations/expectations.go
+++ b/golden/go/expectations/expectations.go
@@ -29,12 +29,6 @@
// has entries with positive and negative labels (i.e. no untriaged entries).
type Baseline map[types.TestName]map[types.Digest]Label
-// BaselineInt is the LabelInt version of Baseline.
-//
-// Used by goldctl while the expectations.LabelStr -> expectations.Label migration is in progress.
-// TODO(skbug.com/10522): Delete once the aforementioned migration is finished.
-type BaselineInt map[types.TestName]map[types.Digest]LabelInt
-
// ReadOnly is an interface with the non-mutating functions of Expectations.
// By using this instead of Expectations, we can make fewer copies, helping performance.
type ReadOnly interface {
@@ -217,25 +211,6 @@
return n.labels
}
-// AsBaselineInt is the LabelInt version of AsBaseline.
-//
-// TODO(skbug.com/10522): Remove once the expectations.LabelStr -> expectations.Label refactoring
-// is complete.
-func (e *Expectations) AsBaselineInt() BaselineInt {
- baseline := e.AsBaseline()
-
- baselineInt := BaselineInt{}
- for testName, digestToLabelStrMap := range baseline {
- digestToLabelMap := map[types.Digest]LabelInt{}
- for digest, labelStr := range digestToLabelStrMap {
- digestToLabelMap[digest] = LabelIntFromString(labelStr)
- }
- baselineInt[testName] = digestToLabelMap
- }
-
- return baselineInt
-}
-
// ensureInit expects that the write mutex is held prior to entry.
func (e *Expectations) ensureInit() {
if e.labels == nil {
diff --git a/golden/go/expectations/expectations_test.go b/golden/go/expectations/expectations_test.go
index 83f06cd..fafc931 100644
--- a/golden/go/expectations/expectations_test.go
+++ b/golden/go/expectations/expectations_test.go
@@ -238,44 +238,6 @@
require.Equal(t, expectedOutput, input.AsBaseline())
}
-// TODO(skbug.com/10522): Remove once the expectations.LabelStr -> expectations.Label refactoring
-// is complete.
-func TestAsBaselineInt(t *testing.T) {
- unittest.SmallTest(t)
- input := Expectations{
- labels: map[types.TestName]map[types.Digest]Label{
- "gamma": {
- "hashX": Untriaged,
- "hashY": Untriaged,
- "hashZ": Untriaged,
- },
- "beta": {
- "hash1": Positive,
- "hash3": Negative,
- "hash2": Untriaged,
- "hash4": Positive,
- },
- "alpha": {
- "hashB": Untriaged,
- "hashA": Negative,
- "hashC": Untriaged,
- },
- },
- }
-
- expectedOutput := BaselineInt{
- "beta": {
- "hash1": PositiveInt,
- "hash3": NegativeInt,
- "hash4": PositiveInt,
- },
- "alpha": {
- "hashA": NegativeInt,
- },
- }
- require.Equal(t, expectedOutput, input.AsBaselineInt())
-}
-
// All this test data is valid, but arbitrary.
const (
alphaPositiveDigest = types.Digest("aaa884cd5ac3d6785c35cff8f26d2da5")
diff --git a/golden/go/testutils/data_three_devices/three_devices.go b/golden/go/testutils/data_three_devices/three_devices.go
index 0531978..60d6aa0 100644
--- a/golden/go/testutils/data_three_devices/three_devices.go
+++ b/golden/go/testutils/data_three_devices/three_devices.go
@@ -67,12 +67,11 @@
e := MakeTestExpectations()
b := baseline.Baseline{
Expectations: e.AsBaseline(),
- ExpectationsInt: e.AsBaselineInt(),
ChangeListID: "",
CodeReviewSystem: "",
}
var err error
- b.MD5, err = util.MD5Sum(b.ExpectationsInt)
+ b.MD5, err = util.MD5Sum(b.Expectations)
if err != nil {
panic(fmt.Sprintf("Error computing MD5 of the baseline: %s", err))
}
diff --git a/golden/go/web/web_test.go b/golden/go/web/web_test.go
index 02268ac..b9cddfb 100644
--- a/golden/go/web/web_test.go
+++ b/golden/go/web/web_test.go
@@ -1427,7 +1427,7 @@
// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
- expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
+ expectedJSONResponse := `{"md5":"fakehash","master_str":null,"crs":"gerrit"}`
// FetchBaseline should be called as per the request parameters.
mbf.On("FetchBaseline", testutils.AnyContext, "" /* =clID */, "gerrit", false /* =issueOnly */).Return(bl, nil)
@@ -1468,7 +1468,7 @@
// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
- expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
+ expectedJSONResponse := `{"md5":"fakehash","master_str":null,"crs":"gerrit"}`
// FetchBaseline should be called as per the request parameters.
mbf.On("FetchBaseline", testutils.AnyContext, "123456" /* =clID */, "gerrit", false /* =issueOnly */).Return(bl, nil)
@@ -1509,7 +1509,7 @@
// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
- expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
+ expectedJSONResponse := `{"md5":"fakehash","master_str":null,"crs":"gerrit"}`
// FetchBaseline should be called as per the request parameters.
mbf.On("FetchBaseline", testutils.AnyContext, "123456" /* =clID */, "gerrit", true /* =issueOnly */).Return(bl, nil)
@@ -1586,7 +1586,7 @@
// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
- expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
+ expectedJSONResponse := `{"md5":"fakehash","master_str":null,"crs":"gerrit"}`
// Note that the {commit_hash} doesn't appear anywhere in the FetchBaseline call.
mbf.On("FetchBaseline", testutils.AnyContext, "" /* =clID */, "gerrit", false /* =issueOnly */).Return(bl, nil)
@@ -1632,7 +1632,7 @@
// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
- expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
+ expectedJSONResponse := `{"md5":"fakehash","master_str":null,"crs":"gerrit"}`
// Note that the {commit_hash} doesn't appear anywhere in the FetchBaseline call.
mbf.On("FetchBaseline", testutils.AnyContext, "123456" /* =clID */, "gerrit", false /* =issueOnly */).Return(bl, nil)
@@ -1678,7 +1678,7 @@
// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
- expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
+ expectedJSONResponse := `{"md5":"fakehash","master_str":null,"crs":"gerrit"}`
// Note that the {commit_hash} doesn't appear anywhere in the FetchBaseline call.
mbf.On("FetchBaseline", testutils.AnyContext, "123456" /* =clID */, "gerrit", true /* =issueOnly */).Return(bl, nil)