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/impl/memory" | 10 "github.com/luci/gae/impl/memory" |
(...skipping 15 matching lines...) Expand all Loading... |
26 f := &AddFinishedDeps{ | 26 f := &AddFinishedDeps{ |
27 &dm.Execution_Auth{ | 27 &dm.Execution_Auth{ |
28 Id: dm.NewExecutionID("quest", 1, 7), | 28 Id: dm.NewExecutionID("quest", 1, 7), |
29 Token: []byte("sup"), | 29 Token: []byte("sup"), |
30 }, | 30 }, |
31 []*model.Quest{ | 31 []*model.Quest{ |
32 { | 32 { |
33 ID: "to", | 33 ID: "to", |
34 BuiltBy: model.TemplateInfo{ | 34 BuiltBy: model.TemplateInfo{ |
35 *dm.NewTemplateSpec("a", "b", "c
", "d"), | 35 *dm.NewTemplateSpec("a", "b", "c
", "d"), |
36 » » » » » }}, | 36 » » » » » }, |
| 37 » » » » }, |
37 }, | 38 }, |
38 dm.NewAttemptList(map[string][]uint32{ | 39 dm.NewAttemptList(map[string][]uint32{ |
39 "to": {1, 2, 3}, | 40 "to": {1, 2, 3}, |
40 }), | 41 }), |
41 } | 42 } |
42 | 43 |
43 base := f.Auth.Id.AttemptID() | 44 base := f.Auth.Id.AttemptID() |
44 fs := model.FwdDepsFromList(c, base, f.FinishedAttempts) | 45 fs := model.FwdDepsFromList(c, base, f.FinishedAttempts) |
45 | 46 |
46 ds := datastore.Get(c) | 47 ds := datastore.Get(c) |
(...skipping 16 matching lines...) Expand all Loading... |
63 datastore.ErrNoSuchEntity, | 64 datastore.ErrNoSuchEntity, |
64 nil, | 65 nil, |
65 datastore.ErrNoSuchEntity, | 66 datastore.ErrNoSuchEntity, |
66 }) | 67 }) |
67 | 68 |
68 muts, err := f.RollForward(c) | 69 muts, err := f.RollForward(c) |
69 So(err, ShouldBeNil) | 70 So(err, ShouldBeNil) |
70 So(muts, ShouldResemble, []tumble.Mutation{ | 71 So(muts, ShouldResemble, []tumble.Mutation{ |
71 &AddBackDep{Dep: fs[0].Edge()}, | 72 &AddBackDep{Dep: fs[0].Edge()}, |
72 &AddBackDep{Dep: fs[2].Edge()}, | 73 &AddBackDep{Dep: fs[2].Edge()}, |
73 » » » » &MergeQuest{f.MergeQuests[0]}, | 74 » » » » &MergeQuest{f.MergeQuests[0], nil}, |
74 }) | 75 }) |
75 | 76 |
76 So(ds.Get(fs), ShouldBeNil) | 77 So(ds.Get(fs), ShouldBeNil) |
77 So(fs[0].ForExecution, ShouldEqual, 7) | 78 So(fs[0].ForExecution, ShouldEqual, 7) |
78 So(fs[1].ForExecution, ShouldEqual, 1) | 79 So(fs[1].ForExecution, ShouldEqual, 1) |
79 So(fs[2].ForExecution, ShouldEqual, 7) | 80 So(fs[2].ForExecution, ShouldEqual, 7) |
80 | 81 |
81 muts, err = f.RollForward(c) | 82 muts, err = f.RollForward(c) |
82 So(err, ShouldBeNil) | 83 So(err, ShouldBeNil) |
83 So(muts, ShouldBeEmpty) | 84 So(muts, ShouldBeEmpty) |
84 }) | 85 }) |
85 | 86 |
86 Convey("RollForward (bad)", func() { | 87 Convey("RollForward (bad)", func() { |
87 So(ds.Delete(ak), ShouldBeNil) | 88 So(ds.Delete(ak), ShouldBeNil) |
88 _, err := f.RollForward(c) | 89 _, err := f.RollForward(c) |
89 » » » So(err, ShouldBeRPCUnauthenticated, "execution Auth") | 90 » » » So(err, ShouldBeRPCInternal, "execution Auth") |
90 }) | 91 }) |
91 }) | 92 }) |
92 } | 93 } |
OLD | NEW |