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

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: 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/activate_execution_test.go ('k') | appengine/cmd/dm/deps/common_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8d734d86ebc7ac797e4e1007896e8beba1340925..3457a0a3abe243c1f57e274a5a2f9bbfd5f48558 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.Put(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"`)
})
})
@@ -76,7 +73,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{
@@ -85,7 +82,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()},
},
}},
})
@@ -97,7 +94,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{
@@ -106,7 +103,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, "", nil)},
},
}},
})
@@ -123,7 +120,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)
})
})
« no previous file with comments | « appengine/cmd/dm/deps/activate_execution_test.go ('k') | appengine/cmd/dm/deps/common_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698