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

Side by Side Diff: impl/memory/memcache_test.go

Issue 1262173003: Use time.Time for internal memcache memory implementation (Closed) Base URL: https://github.com/luci/gae.git@add_rdscache
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 | « impl/memory/memcache.go ('k') | no next file » | 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 memory 5 package memory
6 6
7 import ( 7 import (
8 "testing" 8 "testing"
9 "time" 9 "time"
10 10
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 So(err, ShouldBeNil) 179 So(err, ShouldBeNil)
180 stats, err := mc.Stats() 180 stats, err := mc.Stats()
181 So(err, ShouldBeNil) 181 So(err, ShouldBeNil)
182 So(stats.Items, ShouldEqual, 1) 182 So(stats.Items, ShouldEqual, 1)
183 So(stats.Bytes, ShouldEqual, 4) 183 So(stats.Bytes, ShouldEqual, 4)
184 So(stats.Hits, ShouldEqual, 4) 184 So(stats.Hits, ShouldEqual, 4)
185 So(stats.Misses, ShouldEqual, 1) 185 So(stats.Misses, ShouldEqual, 1)
186 So(stats.ByteHits, ShouldEqual, 4*4) 186 So(stats.ByteHits, ShouldEqual, 4*4)
187 So(mci.data.casID, ShouldEqual, 1) 187 So(mci.data.casID, ShouldEqual, 1)
188 » » » So(mci.data.items["sup"], ShouldResemble, &mcItem{ 188 » » » So(mci.data.items["sup"], ShouldResemble, &mcDataItem{
189 » » » » key: "sup",
190 value: []byte("cool"), 189 value: []byte("cool"),
191 » » » » expiration: time.Duration(curTime.Add(time.Secon d * 2).UnixNano()), 190 » » » » expiration: curTime.Add(time.Second * 2).Truncat e(time.Second),
192 » » » » CasID: 1, 191 » » » » casID: 1,
193 }) 192 })
194 193
195 getItm := mc.NewItem("sup") 194 getItm := mc.NewItem("sup")
196 So(mc.Get(getItm), ShouldBeNil) 195 So(mc.Get(getItm), ShouldBeNil)
197 So(len(mci.data.items), ShouldEqual, 1) 196 So(len(mci.data.items), ShouldEqual, 1)
198 So(mci.data.casID, ShouldEqual, 1) 197 So(mci.data.casID, ShouldEqual, 1)
199 198
200 testItem := &mcItem{ 199 testItem := &mcItem{
201 key: "sup", 200 key: "sup",
202 value: []byte("cool"), 201 value: []byte("cool"),
203 CasID: 1, 202 CasID: 1,
204 } 203 }
205 So(getItm, ShouldResemble, testItem) 204 So(getItm, ShouldResemble, testItem)
206 }) 205 })
207 206
208 }) 207 })
209 } 208 }
OLDNEW
« no previous file with comments | « impl/memory/memcache.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698