OLD | NEW |
1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
4 | 4 |
5 package mutate | 5 package mutate |
6 | 6 |
7 import ( | 7 import ( |
8 "testing" | 8 "testing" |
9 | 9 |
10 "github.com/luci/gae/filter/featureBreaker" | 10 "github.com/luci/gae/filter/featureBreaker" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 So(ds.GetMulti([]interface{}{bdg, bd}),
ShouldBeNil) | 52 So(ds.GetMulti([]interface{}{bdg, bd}),
ShouldBeNil) |
53 So(bd.Edge(), ShouldResemble, abd.Dep) | 53 So(bd.Edge(), ShouldResemble, abd.Dep) |
54 So(bd.Propagated, ShouldBeTrue) | 54 So(bd.Propagated, ShouldBeTrue) |
55 }) | 55 }) |
56 | 56 |
57 Convey("need completion", func() { | 57 Convey("need completion", func() { |
58 abd.NeedsAck = true | 58 abd.NeedsAck = true |
59 muts, err := abd.RollForward(c) | 59 muts, err := abd.RollForward(c) |
60 So(err, ShouldBeNil) | 60 So(err, ShouldBeNil) |
61 » » » » » So(muts, ShouldResemble, []tumble.Mutati
on{ | 61 » » » » » So(muts, ShouldResemble, []tumble.Mutati
on{&AckFwdDep{abd.Dep}}) |
62 » » » » » » &AckFwdDep{abd.Dep, true}}) | |
63 | 62 |
64 So(ds.GetMulti([]interface{}{bdg, bd}),
ShouldBeNil) | 63 So(ds.GetMulti([]interface{}{bdg, bd}),
ShouldBeNil) |
65 So(bd.Edge(), ShouldResemble, abd.Dep) | 64 So(bd.Edge(), ShouldResemble, abd.Dep) |
66 So(bd.Propagated, ShouldBeTrue) | 65 So(bd.Propagated, ShouldBeTrue) |
67 }) | 66 }) |
68 }) | 67 }) |
69 | 68 |
70 Convey("attempt not finished, need completion", func() { | 69 Convey("attempt not finished, need completion", func() { |
71 ex, err := ds.Exists(ds.KeyForObj(bdg)) | 70 ex, err := ds.Exists(ds.KeyForObj(bdg)) |
72 So(err, ShouldBeNil) | 71 So(err, ShouldBeNil) |
73 » » » » So(ex, ShouldBeFalse) | 72 » » » » So(ex.Any(), ShouldBeFalse) |
74 | 73 |
75 abd.NeedsAck = true | 74 abd.NeedsAck = true |
76 muts, err := abd.RollForward(c) | 75 muts, err := abd.RollForward(c) |
77 So(err, ShouldBeNil) | 76 So(err, ShouldBeNil) |
78 » » » » So(muts, ShouldResemble, []tumble.Mutation{ | 77 » » » » So(muts, ShouldBeNil) |
79 » » » » » &AckFwdDep{abd.Dep, false}}) | |
80 | 78 |
81 // Note that bdg was created as a side effect. | 79 // Note that bdg was created as a side effect. |
82 So(ds.GetMulti([]interface{}{bdg, bd}), ShouldBe
Nil) | 80 So(ds.GetMulti([]interface{}{bdg, bd}), ShouldBe
Nil) |
83 So(bd.Edge(), ShouldResemble, abd.Dep) | 81 So(bd.Edge(), ShouldResemble, abd.Dep) |
84 So(bd.Propagated, ShouldBeFalse) | 82 So(bd.Propagated, ShouldBeFalse) |
85 So(bdg.AttemptFinished, ShouldBeFalse) | 83 So(bdg.AttemptFinished, ShouldBeFalse) |
86 }) | 84 }) |
87 | 85 |
88 Convey("failure", func() { | 86 Convey("failure", func() { |
89 c, fb := featureBreaker.FilterRDS(c, nil) | 87 c, fb := featureBreaker.FilterRDS(c, nil) |
90 fb.BreakFeatures(nil, "PutMulti") | 88 fb.BreakFeatures(nil, "PutMulti") |
91 | 89 |
92 _, err := abd.RollForward(c) | 90 _, err := abd.RollForward(c) |
93 So(err, ShouldErrLike, `feature "PutMulti" is br
oken`) | 91 So(err, ShouldErrLike, `feature "PutMulti" is br
oken`) |
94 }) | 92 }) |
95 }) | 93 }) |
96 }) | 94 }) |
97 } | 95 } |
OLD | NEW |