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

Side by Side Diff: go/src/infra/gae/libs/wrapper/memory/memcache_test.go

Issue 986553002: A simple memcache lock for appengine. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@meta
Patch Set: rebase Created 5 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
« DEPS ('K') | « go/src/infra/gae/libs/wrapper/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 "infra/gae/libs/wrapper" 8 "infra/gae/libs/wrapper"
9 "infra/gae/libs/wrapper/unsafe" 9 "infra/gae/libs/wrapper/unsafe"
10 "testing" 10 "testing"
(...skipping 10 matching lines...) Expand all
21 21
22 Convey("memcache", t, func() { 22 Convey("memcache", t, func() {
23 now := time.Now() 23 now := time.Now()
24 timeNow := func(context.Context) time.Time { 24 timeNow := func(context.Context) time.Time {
25 ret := now 25 ret := now
26 now = now.Add(time.Second) 26 now = now.Add(time.Second)
27 return ret 27 return ret
28 } 28 }
29 c := Use(wrapper.SetTimeNowFactory(context.Background(), timeNow )) 29 c := Use(wrapper.SetTimeNowFactory(context.Background(), timeNow ))
30 mc := wrapper.GetMC(c) 30 mc := wrapper.GetMC(c)
31 » » mci := mc.(*memcacheImpl) 31 » » mci := wrapper.GetMC(c).(*memcacheImpl)
32 » » So(mc, ShouldNotEqual, mci) // two impls with the same memcacheD ata
32 33
33 Convey("implements MCSingleReadWriter", func() { 34 Convey("implements MCSingleReadWriter", func() {
34 Convey("Add", func() { 35 Convey("Add", func() {
35 itm := &memcache.Item{ 36 itm := &memcache.Item{
36 Key: "sup", 37 Key: "sup",
37 Value: []byte("cool"), 38 Value: []byte("cool"),
38 Expiration: time.Second, 39 Expiration: time.Second,
39 } 40 }
40 err := mc.Add(itm) 41 err := mc.Add(itm)
41 So(err, ShouldBeNil) 42 So(err, ShouldBeNil)
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 testItem := &memcache.Item{ 211 testItem := &memcache.Item{
211 Key: "sup", 212 Key: "sup",
212 Value: []byte("cool"), 213 Value: []byte("cool"),
213 } 214 }
214 unsafe.MCSetCasID(testItem, 1) 215 unsafe.MCSetCasID(testItem, 1)
215 So(el, ShouldResemble, testItem) 216 So(el, ShouldResemble, testItem)
216 }) 217 })
217 218
218 }) 219 })
219 } 220 }
OLDNEW
« DEPS ('K') | « go/src/infra/gae/libs/wrapper/memory/memcache.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698