[gold] Remove Clear from expstore interface
Is likely unneeded. We can always clean things up with a cronjob if
really necessary.
Bug: skia:9090
Change-Id: Ic8c90d1ab5e2b281f297389f4d9599a3e6d2afcc
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/217937
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
diff --git a/golden/go/expstorage/ds_expstore/ds_expstore_test.go b/golden/go/expstorage/ds_expstore/ds_expstore_test.go
index 1cf9d8c..276b4b5e 100644
--- a/golden/go/expstorage/ds_expstore/ds_expstore_test.go
+++ b/golden/go/expstorage/ds_expstore/ds_expstore_test.go
@@ -41,7 +41,7 @@
testCloudExpstoreClear(t, cloudStore)
}
-func testCloudExpstoreClear(t *testing.T, cloudStore expstorage.ExpectationsStore) {
+func testCloudExpstoreClear(t *testing.T, cloudStore *DSExpStore) {
// Make sure the clear works.
ctx := context.Background()
assert.NoError(t, cloudStore.Clear(ctx))
@@ -70,7 +70,7 @@
issueID := int64(1234567)
issueStore := issueStoreFactory(issueID)
testExpectationStore(t, issueStore, masterEventBus, issueID, expstorage.EV_TRYJOB_EXP_CHANGED)
- testCloudExpstoreClear(t, issueStore)
+ testCloudExpstoreClear(t, issueStore.(*DSExpStore))
}
// initDS initializes the datastore for testing.
diff --git a/golden/go/expstorage/types.go b/golden/go/expstorage/types.go
index 739a6d9..f29036c 100644
--- a/golden/go/expstorage/types.go
+++ b/golden/go/expstorage/types.go
@@ -52,12 +52,6 @@
// A new entry is added to the log with a reference to the change that was
// undone.
UndoChange(ctx context.Context, changeID int64, userID string) (types.Expectations, error)
-
- // Clear deletes all expectations in this ExpectationsStore. This is mostly
- // used for testing, but also to delete the expectations for a Gerrit issue.
- // See the tryjobstore package.
- // TODO(kjlubick): I think this should be removed
- Clear(ctx context.Context) error
}
// TriageDetails represents one changed digest and the label that was
diff --git a/golden/go/mocks/ExpectationsStore.go b/golden/go/mocks/ExpectationsStore.go
index 318853f..f4214b7 100644
--- a/golden/go/mocks/ExpectationsStore.go
+++ b/golden/go/mocks/ExpectationsStore.go
@@ -26,20 +26,6 @@
return r0
}
-// Clear provides a mock function with given fields: ctx
-func (_m *ExpectationsStore) Clear(ctx context.Context) error {
- ret := _m.Called(ctx)
-
- var r0 error
- if rf, ok := ret.Get(0).(func(context.Context) error); ok {
- r0 = rf(ctx)
- } else {
- r0 = ret.Error(0)
- }
-
- return r0
-}
-
// Get provides a mock function with given fields:
func (_m *ExpectationsStore) Get() (types.Expectations, error) {
ret := _m.Called()
diff --git a/golden/go/tryjobstore/tryjobstore.go b/golden/go/tryjobstore/tryjobstore.go
index bf5a3b1..5494f83 100644
--- a/golden/go/tryjobstore/tryjobstore.go
+++ b/golden/go/tryjobstore/tryjobstore.go
@@ -11,6 +11,7 @@
"go.skia.org/infra/go/ds"
"go.skia.org/infra/go/eventbus"
"go.skia.org/infra/go/gevent"
+ "go.skia.org/infra/go/skerr"
"go.skia.org/infra/go/sklog"
"go.skia.org/infra/go/util"
"go.skia.org/infra/golden/go/expstorage"
@@ -233,25 +234,13 @@
// DeleteIssue implements the TryjobStore interface.
func (c *cloudTryjobStore) DeleteIssue(issueID int64) error {
ctx := context.TODO()
- key := c.getIssueKey(issueID)
- var egroup errgroup.Group
-
- egroup.Go(func() error {
- // Delete any tryjobs that are still there.
- return c.deleteTryjobsForIssue(issueID)
- })
-
- // Remove the expectations for this issue.
- egroup.Go(func() error {
- return c.expStoreFactory(issueID).Clear(ctx)
- })
-
- // Make sure all dependents are deleted.
- if err := egroup.Wait(); err != nil {
- return err
+ // Delete any tryjobs that are still there.
+ if err := c.deleteTryjobsForIssue(issueID); err != nil {
+ return skerr.Fmt("could not delete tryjobs for issue %d: %s", issueID, err)
}
+ key := c.getIssueKey(issueID)
// Delete the entity.
return c.client.Delete(ctx, key)
}