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

Unified Diff: appengine/cmd/dm/mutate/ack_fwd_dep_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/mutate/ack_fwd_dep.go ('k') | appengine/cmd/dm/mutate/activate_execution.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/cmd/dm/mutate/ack_fwd_dep_test.go
diff --git a/appengine/cmd/dm/mutate/ack_fwd_dep_test.go b/appengine/cmd/dm/mutate/ack_fwd_dep_test.go
index 7686983d222fb99ef612be922a3b57484f832c50..165ed36d60f01c2d172d2a19b238a4dcde7da204 100644
--- a/appengine/cmd/dm/mutate/ack_fwd_dep_test.go
+++ b/appengine/cmd/dm/mutate/ack_fwd_dep_test.go
@@ -41,91 +41,38 @@ func TestAckFwdDep(t *testing.T) {
Convey("AddingDeps", func() {
Convey("good", func() {
- a.State = dm.Attempt_ADDING_DEPS
- a.AddingDepsBitmap = bf.Make(2)
- a.WaitingDepBitmap = bf.Make(2)
+ a.State = dm.Attempt_WAITING
+ a.DepMap = bf.Make(2)
So(ds.Put(a, fwd), ShouldBeNil)
- Convey("non-finished, not-last-adding", func() {
+ Convey("not-last", func() {
muts, err := afd.RollForward(c)
So(err, ShouldBeNil)
So(muts, ShouldBeNil)
So(ds.Get(a, fwd), ShouldBeNil)
- So(a.State, ShouldEqual, dm.Attempt_ADDING_DEPS)
- So(a.AddingDepsBitmap.CountSet(), ShouldEqual, 1)
- So(a.WaitingDepBitmap.CountSet(), ShouldEqual, 0)
- })
-
- Convey("non-finished, last-adding", func() {
- a.AddingDepsBitmap.Set(1)
- So(ds.Put(a), ShouldBeNil)
-
- muts, err := afd.RollForward(c)
- So(err, ShouldBeNil)
- So(muts, ShouldBeNil)
-
- So(ds.Get(a, fwd), ShouldBeNil)
- So(a.State, ShouldEqual, dm.Attempt_BLOCKED)
- So(a.AddingDepsBitmap.CountSet(), ShouldEqual, 2)
- So(a.WaitingDepBitmap.CountSet(), ShouldEqual, 0)
-
- Convey("and then finished later", func() {
- // happens when we depend on an Attempt while it's not Finished,
- // but then it finishes later.
-
- afd.DepIsFinished = true
-
- muts, err := afd.RollForward(c)
- So(err, ShouldBeNil)
- So(muts, ShouldBeNil)
-
- So(ds.Get(a, fwd), ShouldBeNil)
- So(a.State, ShouldEqual, dm.Attempt_BLOCKED)
- So(a.AddingDepsBitmap.CountSet(), ShouldEqual, 2)
- So(a.WaitingDepBitmap.CountSet(), ShouldEqual, 1)
- })
- })
-
- Convey("finished, not-last-finished", func() {
- a.AddingDepsBitmap.Set(1)
- So(ds.Put(a), ShouldBeNil)
-
- afd.DepIsFinished = true
-
- muts, err := afd.RollForward(c)
- So(err, ShouldBeNil)
- So(muts, ShouldBeNil)
-
- So(ds.Get(a, fwd), ShouldBeNil)
- So(a.State, ShouldEqual, dm.Attempt_BLOCKED)
- So(a.AddingDepsBitmap.CountSet(), ShouldEqual, 2)
- So(a.WaitingDepBitmap.CountSet(), ShouldEqual, 1)
+ So(a.State, ShouldEqual, dm.Attempt_WAITING)
+ So(a.DepMap.CountSet(), ShouldEqual, 1)
})
Convey("last-finished", func() {
- a.AddingDepsBitmap.Set(1)
- a.WaitingDepBitmap.Set(1)
+ a.DepMap.Set(1)
So(ds.Put(a), ShouldBeNil)
- afd.DepIsFinished = true
-
muts, err := afd.RollForward(c)
So(err, ShouldBeNil)
So(muts, ShouldResemble, []tumble.Mutation{
&ScheduleExecution{&a.ID}})
So(ds.Get(a, fwd), ShouldBeNil)
- So(a.State, ShouldEqual, dm.Attempt_NEEDS_EXECUTION)
- So(a.AddingDepsBitmap.CountSet(), ShouldEqual, 2)
- So(a.WaitingDepBitmap.CountSet(), ShouldEqual, 2)
+ So(a.State, ShouldEqual, dm.Attempt_SCHEDULING)
+ So(a.DepMap.CountSet(), ShouldEqual, 0) // was reset
})
})
Convey("bad", func() {
- a.State = dm.Attempt_ADDING_DEPS
- a.AddingDepsBitmap = bf.Make(2)
- a.WaitingDepBitmap = bf.Make(2)
+ a.State = dm.Attempt_WAITING
+ a.DepMap = bf.Make(2)
a.CurExecution = 1
So(ds.Put(a, fwd), ShouldBeNil)
@@ -135,9 +82,8 @@ func TestAckFwdDep(t *testing.T) {
So(muts, ShouldBeNil)
So(ds.Get(a, fwd), ShouldBeNil)
- So(a.State, ShouldEqual, dm.Attempt_ADDING_DEPS)
- So(a.AddingDepsBitmap.CountSet(), ShouldEqual, 0)
- So(a.WaitingDepBitmap.CountSet(), ShouldEqual, 0)
+ So(a.State, ShouldEqual, dm.Attempt_WAITING)
+ So(a.DepMap.CountSet(), ShouldEqual, 0)
})
Convey("Missing data", func() {
« no previous file with comments | « appengine/cmd/dm/mutate/ack_fwd_dep.go ('k') | appengine/cmd/dm/mutate/activate_execution.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698