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

Unified Diff: appengine/cmd/dm/deps/finish_attempt_test.go

Issue 1537883002: Initial distributor implementation (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: self review Created 4 years, 6 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: appengine/cmd/dm/deps/finish_attempt_test.go
diff --git a/appengine/cmd/dm/deps/finish_attempt_test.go b/appengine/cmd/dm/deps/finish_attempt_test.go
index c97ff7140461db90af90d9068368b91248732475..d5958569f9fa3af19b88d0f2a81cde240e5c2e67 100644
--- a/appengine/cmd/dm/deps/finish_attempt_test.go
+++ b/appengine/cmd/dm/deps/finish_attempt_test.go
@@ -7,7 +7,6 @@ package deps
import (
"testing"
- "github.com/luci/gae/impl/memory"
"github.com/luci/gae/service/datastore"
"github.com/luci/luci-go/appengine/cmd/dm/model"
"github.com/luci/luci-go/common/api/dm/service/v1"
@@ -15,16 +14,14 @@ import (
google_pb "github.com/luci/luci-go/common/proto/google"
. "github.com/luci/luci-go/common/testing/assertions"
. "github.com/smartystreets/goconvey/convey"
- "golang.org/x/net/context"
)
func TestFinishAttempt(t *testing.T) {
t.Parallel()
Convey("FinishAttempt", t, func() {
- c := memory.Use(context.Background())
+ _, c, _, s := testSetup()
ds := datastore.Get(c)
- s := newDecoratedDeps()
So(ds.Put(&model.Quest{ID: "quest"}), ShouldBeNil)
a := &model.Attempt{
@@ -32,6 +29,8 @@ func TestFinishAttempt(t *testing.T) {
State: dm.Attempt_EXECUTING,
CurExecution: 1,
}
+ e := model.ExecutionFromID(c, dm.NewExecutionID("quest", 1, 1))
+ ar := &model.AttemptResult{Attempt: ds.KeyForObj(a)}
So(ds.Put(a), ShouldBeNil)
So(ds.Put(&model.Execution{
ID: 1, Attempt: ds.KeyForObj(a), Token: []byte("exKey"),
@@ -64,8 +63,12 @@ func TestFinishAttempt(t *testing.T) {
_, err := s.FinishAttempt(c, req)
So(err, ShouldBeNil)
- So(ds.Get(a), ShouldBeNil)
- So(a.State, ShouldEqual, dm.Attempt_FINISHED)
+ So(ds.GetMulti([]interface{}{a, ar, e}), ShouldBeNil)
+ So(a.State, ShouldEqual, dm.Attempt_EXECUTING)
+ So(e.State, ShouldEqual, dm.Execution_STOPPING)
+
+ So(a.ResultSize, ShouldEqual, 21)
+ So(ar.Size, ShouldEqual, 21)
})
})

Powered by Google App Engine
This is Rietveld 408576698