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

Side by Side Diff: filter/count/count_test.go

Issue 1270063003: Make the rest of the services have a similar raw/user interface structure. (Closed) Base URL: https://github.com/luci/gae.git@add_datastore
Patch Set: address comments Created 5 years, 4 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
« no previous file with comments | « doc.go ('k') | filter/count/mc.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package count 5 package count
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "testing" 9 "testing"
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 }) 70 })
71 }) 71 })
72 72
73 Convey("works for memcache", t, func() { 73 Convey("works for memcache", t, func() {
74 c, ctr := FilterMC(memory.Use(context.Background())) 74 c, ctr := FilterMC(memory.Use(context.Background()))
75 So(c, ShouldNotBeNil) 75 So(c, ShouldNotBeNil)
76 So(ctr, ShouldNotBeNil) 76 So(ctr, ShouldNotBeNil)
77 mc := memcache.Get(c) 77 mc := memcache.Get(c)
78 78
79 mc.Set(mc.NewItem("hello").SetValue([]byte("sup"))) 79 mc.Set(mc.NewItem("hello").SetValue([]byte("sup")))
80 » » mc.Get("Wat") 80 » » So(mc.Get(mc.NewItem("Wat")), ShouldNotBeNil)
81 » » mc.Get("hello") 81 » » mc.Get(mc.NewItem("hello"))
82 82
83 » » So(ctr.Set, ShouldResemble, Entry{1, 0}) 83 » » So(ctr.SetMulti, ShouldResemble, Entry{1, 0})
84 » » So(ctr.Get, ShouldResemble, Entry{1, 1}) 84 » » So(ctr.GetMulti, ShouldResemble, Entry{2, 0})
85 » » So(ctr.NewItem, ShouldResemble, Entry{1, 0}) 85 » » So(ctr.NewItem, ShouldResemble, Entry{3, 0})
86 }) 86 })
87 87
88 Convey("works for taskqueue", t, func() { 88 Convey("works for taskqueue", t, func() {
89 c, ctr := FilterTQ(memory.Use(context.Background())) 89 c, ctr := FilterTQ(memory.Use(context.Background()))
90 So(c, ShouldNotBeNil) 90 So(c, ShouldNotBeNil)
91 So(ctr, ShouldNotBeNil) 91 So(ctr, ShouldNotBeNil)
92 tq := taskqueue.Get(c) 92 tq := taskqueue.Get(c)
93 93
94 tq.Add(&taskqueue.Task{Name: "wat"}, "") 94 tq.Add(&taskqueue.Task{Name: "wat"}, "")
95 tq.Add(&taskqueue.Task{Name: "wat"}, "DNE_QUEUE") 95 tq.Add(&taskqueue.Task{Name: "wat"}, "DNE_QUEUE")
96 96
97 » » So(ctr.Add, ShouldResemble, Entry{1, 1}) 97 » » So(ctr.AddMulti, ShouldResemble, Entry{1, 1})
98 }) 98 })
99 99
100 Convey("works for global info", t, func() { 100 Convey("works for global info", t, func() {
101 c, fb := featureBreaker.FilterGI(memory.Use(context.Background() ), nil) 101 c, fb := featureBreaker.FilterGI(memory.Use(context.Background() ), nil)
102 c, ctr := FilterGI(c) 102 c, ctr := FilterGI(c)
103 So(c, ShouldNotBeNil) 103 So(c, ShouldNotBeNil)
104 So(ctr, ShouldNotBeNil) 104 So(ctr, ShouldNotBeNil)
105 105
106 gi := info.Get(c) 106 gi := info.Get(c)
107 107
(...skipping 29 matching lines...) Expand all
137 someCalledFunc(c) 137 someCalledFunc(c)
138 someCalledFunc(c) 138 someCalledFunc(c)
139 139
140 // Then we can see what happened! 140 // Then we can see what happened!
141 fmt.Printf("%#v\n", counter.NewKey) 141 fmt.Printf("%#v\n", counter.NewKey)
142 fmt.Printf("%d\n", counter.PutMulti.Successes) 142 fmt.Printf("%d\n", counter.PutMulti.Successes)
143 // Output: 143 // Output:
144 // count.Entry{Successes:2, Errors:0} 144 // count.Entry{Successes:2, Errors:0}
145 // 2 145 // 2
146 } 146 }
OLDNEW
« no previous file with comments | « doc.go ('k') | filter/count/mc.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698