| 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)
|
| })
|
| })
|
| })
|
|
|