OLD | NEW |
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 fb.UnbreakFeatures("GetMulti") | 86 fb.UnbreakFeatures("GetMulti") |
87 | 87 |
88 So(ds.PutMulti(vals), ShouldBeNil) | 88 So(ds.PutMulti(vals), ShouldBeNil) |
89 | 89 |
90 die(ds.GetMulti(vals)) | 90 die(ds.GetMulti(vals)) |
91 So(ctr.GetMulti.Errors(), ShouldEqual, 1) | 91 So(ctr.GetMulti.Errors(), ShouldEqual, 1) |
92 So(ctr.GetMulti.Successes(), ShouldEqual, 1) | 92 So(ctr.GetMulti.Successes(), ShouldEqual, 1) |
93 So(ctr.GetMulti.Total(), ShouldEqual, 2) | 93 So(ctr.GetMulti.Total(), ShouldEqual, 2) |
94 }) | 94 }) |
| 95 |
| 96 Convey(`datastore.Stop does not count as an error`, func() { |
| 97 fb.BreakFeatures(datastore.Stop, "GetMulti") |
| 98 |
| 99 So(ds.GetMulti(vals), ShouldBeNil) |
| 100 So(ctr.GetMulti.Successes(), ShouldEqual, 1) |
| 101 So(ctr.GetMulti.Errors(), ShouldEqual, 0) |
| 102 So(ctr.GetMulti.Total(), ShouldEqual, 1) |
| 103 }) |
95 }) | 104 }) |
96 | 105 |
97 Convey("works for memcache", t, func() { | 106 Convey("works for memcache", t, func() { |
98 c, ctr := FilterMC(memory.Use(context.Background())) | 107 c, ctr := FilterMC(memory.Use(context.Background())) |
99 So(c, ShouldNotBeNil) | 108 So(c, ShouldNotBeNil) |
100 So(ctr, ShouldNotBeNil) | 109 So(ctr, ShouldNotBeNil) |
101 mc := memcache.Get(c) | 110 mc := memcache.Get(c) |
102 | 111 |
103 die(mc.Set(mc.NewItem("hello").SetValue([]byte("sup")))) | 112 die(mc.Set(mc.NewItem("hello").SetValue([]byte("sup")))) |
104 | 113 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 218 |
210 // Using the other function. | 219 // Using the other function. |
211 someCalledFunc(c) | 220 someCalledFunc(c) |
212 someCalledFunc(c) | 221 someCalledFunc(c) |
213 | 222 |
214 // Then we can see what happened! | 223 // Then we can see what happened! |
215 fmt.Printf("%d\n", counter.PutMulti.Successes()) | 224 fmt.Printf("%d\n", counter.PutMulti.Successes()) |
216 // Output: | 225 // Output: |
217 // 2 | 226 // 2 |
218 } | 227 } |
OLD | NEW |