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

Side by Side Diff: appengine/cmd/dm/mutate/merge_quest_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 unified diff | Download patch
OLDNEW
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"
11 "github.com/luci/gae/service/datastore" 11 "github.com/luci/gae/service/datastore"
12 "github.com/luci/luci-go/appengine/cmd/dm/model" 12 "github.com/luci/luci-go/appengine/cmd/dm/model"
13 "github.com/luci/luci-go/appengine/tumble" 13 "github.com/luci/luci-go/appengine/tumble"
14 "github.com/luci/luci-go/common/api/dm/service/v1" 14 "github.com/luci/luci-go/common/api/dm/service/v1"
15 . "github.com/luci/luci-go/common/testing/assertions" 15 . "github.com/luci/luci-go/common/testing/assertions"
16 . "github.com/smartystreets/goconvey/convey" 16 . "github.com/smartystreets/goconvey/convey"
17 ) 17 )
18 18
19 func TestMergeQuest(t *testing.T) { 19 func TestMergeQuest(t *testing.T) {
20 t.Parallel() 20 t.Parallel()
21 21
22 Convey("MergeQuest", t, func() { 22 Convey("MergeQuest", t, func() {
23 ttest := &tumble.Testing{} 23 ttest := &tumble.Testing{}
24 c := ttest.Context() 24 c := ttest.Context()
25 ds := datastore.Get(c) 25 ds := datastore.Get(c)
26 26
27 » » desc := dm.NewQuestDesc("distributor", `{"data":"yes"}`) 27 » » desc := dm.NewQuestDesc("distributor", `{"data":"yes"}`, nil)
28 » » qst, err := model.NewQuest(c, desc) 28 » » So(desc.Normalize(), ShouldBeNil)
29 » » So(err, ShouldBeNil) 29 » » qst := model.NewQuest(c, desc)
30 qst.BuiltBy = append(qst.BuiltBy, *dm.NewTemplateSpec("a", "b", "c", "d")) 30 qst.BuiltBy = append(qst.BuiltBy, *dm.NewTemplateSpec("a", "b", "c", "d"))
31 31
32 » » mq := &MergeQuest{qst} 32 » » mq := &MergeQuest{qst, nil}
33 33
34 Convey("root", func() { 34 Convey("root", func() {
35 So(mq.Root(c), ShouldResemble, ds.MakeKey("Quest", qst.I D)) 35 So(mq.Root(c), ShouldResemble, ds.MakeKey("Quest", qst.I D))
36 }) 36 })
37 37
38 Convey("quest doesn't exist", func() { 38 Convey("quest doesn't exist", func() {
39 muts, err := mq.RollForward(c) 39 muts, err := mq.RollForward(c)
40 So(err, ShouldBeNil) 40 So(err, ShouldBeNil)
41 So(muts, ShouldBeEmpty) 41 So(muts, ShouldBeEmpty)
42 42
(...skipping 27 matching lines...) Expand all
70 Convey("datastore fail", func() { 70 Convey("datastore fail", func() {
71 c, fb := featureBreaker.FilterRDS(c, nil) 71 c, fb := featureBreaker.FilterRDS(c, nil)
72 fb.BreakFeatures(nil, "GetMulti") 72 fb.BreakFeatures(nil, "GetMulti")
73 _, err := mq.RollForward(c) 73 _, err := mq.RollForward(c)
74 So(err, ShouldBeRPCUnknown) 74 So(err, ShouldBeRPCUnknown)
75 }) 75 })
76 }) 76 })
77 77
78 }) 78 })
79 } 79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698