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

Unified Diff: impl/memory/memcache_test.go

Issue 1243323002: Refactor a bit. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix golint Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « impl/memory/memcache.go ('k') | impl/memory/plist.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/memcache_test.go
diff --git a/memory/memcache_test.go b/impl/memory/memcache_test.go
similarity index 91%
rename from memory/memcache_test.go
rename to impl/memory/memcache_test.go
index 6c9985821fd04ef7c34dcb145054dbda1e6ee9c1..9aaefa534f13bf4f73f06693b9a594ddcb6f3178 100644
--- a/memory/memcache_test.go
+++ b/impl/memory/memcache_test.go
@@ -8,7 +8,7 @@ import (
"testing"
"time"
- "github.com/luci/gae"
+ mcS "github.com/luci/gae/service/memcache"
"github.com/luci/luci-go/common/clock/testclock"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
@@ -21,7 +21,7 @@ func TestMemcache(t *testing.T) {
now := time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)
c, tc := testclock.UseTime(context.Background(), now)
c = Use(c)
- mc := gae.GetMC(c)
+ mc := mcS.Get(c)
Convey("implements MCSingleReadWriter", func() {
Convey("Add", func() {
@@ -34,7 +34,7 @@ func TestMemcache(t *testing.T) {
So(err, ShouldBeNil)
Convey("which rejects objects already there", func() {
err := mc.Add(itm)
- So(err, ShouldEqual, gae.ErrMCNotStored)
+ So(err, ShouldEqual, mcS.ErrNotStored)
})
})
@@ -59,7 +59,7 @@ func TestMemcache(t *testing.T) {
Convey("which can expire", func() {
tc.Add(time.Second * 4)
i, err := mc.Get("sup")
- So(err, ShouldEqual, gae.ErrMCCacheMiss)
+ So(err, ShouldEqual, mcS.ErrCacheMiss)
So(i, ShouldBeNil)
})
})
@@ -78,13 +78,13 @@ func TestMemcache(t *testing.T) {
So(err, ShouldBeNil)
i, err := mc.Get("sup")
- So(err, ShouldEqual, gae.ErrMCCacheMiss)
+ So(err, ShouldEqual, mcS.ErrCacheMiss)
So(i, ShouldBeNil)
})
Convey("but not if it's not there", func() {
err := mc.Delete("sup")
- So(err, ShouldEqual, gae.ErrMCCacheMiss)
+ So(err, ShouldEqual, mcS.ErrCacheMiss)
})
})
@@ -112,7 +112,7 @@ func TestMemcache(t *testing.T) {
})
Convey("CompareAndSwap", func() {
- itm := gae.MCItem(&mcItem{
+ itm := mcS.Item(&mcItem{
key: "sup",
value: []byte("cool"),
expiration: time.Second * 2,
@@ -133,14 +133,14 @@ func TestMemcache(t *testing.T) {
Convey("but fails if you don't", func() {
itm.SetValue([]byte("newp"))
err = mc.CompareAndSwap(itm)
- So(err, ShouldEqual, gae.ErrMCCASConflict)
+ So(err, ShouldEqual, mcS.ErrCASConflict)
})
Convey("and fails if the item is expired/gone", func() {
tc.Add(3 * time.Second)
itm.SetValue([]byte("newp"))
err = mc.CompareAndSwap(itm)
- So(err, ShouldEqual, gae.ErrMCNotStored)
+ So(err, ShouldEqual, mcS.ErrNotStored)
})
})
})
« no previous file with comments | « impl/memory/memcache.go ('k') | impl/memory/plist.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698