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

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: fix imports and make dummy.go a real file 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
« no previous file with comments | « appengine/cmd/dm/deps/finish_attempt.go ('k') | appengine/cmd/dm/deps/service.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..83009ff4cba7a5389f0f9d20bad8e4d588d5570c 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"),
@@ -50,7 +49,7 @@ func TestFinishAttempt(t *testing.T) {
Convey("bad Token", func() {
req.Auth.Token = []byte("fake")
_, err := s.FinishAttempt(c, req)
- So(err, ShouldBeRPCUnauthenticated, "execution Auth")
+ So(err, ShouldBeRPCPermissionDenied, "execution Auth")
})
Convey("not real json", func() {
@@ -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.Get(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)
})
})
« no previous file with comments | « appengine/cmd/dm/deps/finish_attempt.go ('k') | appengine/cmd/dm/deps/service.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698