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

Unified Diff: appengine/cmd/dm/deps/add_deps_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/add_deps_test.go
diff --git a/appengine/cmd/dm/deps/add_deps_test.go b/appengine/cmd/dm/deps/add_deps_test.go
index bf0d752456fa7487d3fdbd18de3d72ba46fcc523..75cd61b9a302d6121f5488ecaf81f411fc11a8c6 100644
--- a/appengine/cmd/dm/deps/add_deps_test.go
+++ b/appengine/cmd/dm/deps/add_deps_test.go
@@ -10,7 +10,6 @@ import (
"github.com/luci/gae/service/datastore"
"github.com/luci/luci-go/appengine/cmd/dm/model"
- "github.com/luci/luci-go/appengine/tumble"
"github.com/luci/luci-go/common/api/dm/service/v1"
. "github.com/luci/luci-go/common/testing/assertions"
. "github.com/smartystreets/goconvey/convey"
@@ -20,10 +19,8 @@ func TestAddDeps(t *testing.T) {
t.Parallel()
Convey("EnsureGraphData (Adding deps)", t, func() {
- ttest := &tumble.Testing{}
- c := ttest.Context()
+ _, c, _, s := testSetup()
ds := datastore.Get(c)
- s := newDecoratedDeps()
zt := time.Time{}
a := &model.Attempt{ID: *dm.NewAttemptID("quest", 1)}
@@ -36,11 +33,11 @@ func TestAddDeps(t *testing.T) {
State: dm.Execution_RUNNING}
toQuestDesc := &dm.Quest_Desc{
- DistributorConfigName: "foof",
+ DistributorConfigName: "fakeDistributor",
JsonPayload: `{"data":"yes"}`,
}
- toQuest, err := model.NewQuest(c, toQuestDesc)
- So(err, ShouldBeNil)
+ So(toQuestDesc.Normalize(), ShouldBeNil)
+ toQuest := model.NewQuest(c, toQuestDesc)
to := &model.Attempt{ID: *dm.NewAttemptID(toQuest.ID, 1)}
fwd := &model.FwdDep{Depender: ak, Dependee: to.ID}
@@ -64,7 +61,7 @@ func TestAddDeps(t *testing.T) {
So(ds.PutMulti([]interface{}{a, e}), ShouldBeNil)
_, err := s.EnsureGraphData(c, req)
- So(err, ShouldBeRPCInvalidArgument, `cannot create attempts for absent quest "Q9SgH-f5kraxP_om80CdR9EmAvgmnUws_s5fvRmZiuc"`)
+ So(err, ShouldBeRPCInvalidArgument, `cannot create attempts for absent quest "FwcLo7vH7d24_mnsKIyKswk3NSezONOAKuDZwHrgl7M"`)
})
})
@@ -77,7 +74,7 @@ func TestAddDeps(t *testing.T) {
rsp, err := s.EnsureGraphData(c, req)
So(err, ShouldBeNil)
- purgeTimestamps(rsp.Result)
+ rsp.Result.PurgeTimestamps()
So(rsp, ShouldResemble, &dm.EnsureGraphDataRsp{
Accepted: true,
Result: &dm.GraphData{Quests: map[string]*dm.Quest{
@@ -86,7 +83,7 @@ func TestAddDeps(t *testing.T) {
Desc: toQuestDesc,
BuiltBy: []*dm.Quest_TemplateSpec{},
},
- Attempts: map[uint32]*dm.Attempt{1: dm.NewAttemptNeedsExecution(zt)},
+ Attempts: map[uint32]*dm.Attempt{1: dm.NewAttemptScheduling()},
},
}},
})
@@ -98,7 +95,7 @@ func TestAddDeps(t *testing.T) {
rsp, err := s.EnsureGraphData(c, req)
So(err, ShouldBeNil)
- purgeTimestamps(rsp.Result)
+ rsp.Result.PurgeTimestamps()
So(rsp, ShouldResemble, &dm.EnsureGraphDataRsp{
Accepted: true,
Result: &dm.GraphData{Quests: map[string]*dm.Quest{
@@ -107,7 +104,7 @@ func TestAddDeps(t *testing.T) {
Desc: toQuestDesc,
BuiltBy: []*dm.Quest_TemplateSpec{},
},
- Attempts: map[uint32]*dm.Attempt{1: dm.NewAttemptFinished(zt, 0, "")},
+ Attempts: map[uint32]*dm.Attempt{1: dm.NewAttemptFinished(zt, 0, "", "")},
},
}},
})
@@ -124,7 +121,9 @@ func TestAddDeps(t *testing.T) {
So(ds.Get(fwd), ShouldBeNil)
So(ds.Get(a), ShouldBeNil)
- So(a.State, ShouldEqual, dm.Attempt_ADDING_DEPS)
+ So(a.State, ShouldEqual, dm.Attempt_EXECUTING)
+ So(ds.Get(e), ShouldBeNil)
+ So(e.State, ShouldEqual, dm.Execution_STOPPING)
})
})

Powered by Google App Engine
This is Rietveld 408576698