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

Unified Diff: luci_config/appengine/backend/memcache/cache_test.go

Issue 2640813005: Fold config service URL into datastore cache keys. (Closed)
Patch Set: Rebase. Created 3 years, 11 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
Index: luci_config/appengine/backend/memcache/cache_test.go
diff --git a/luci_config/appengine/backend/memcache/cache_test.go b/luci_config/appengine/backend/memcache/cache_test.go
index 9ba85107adbb51d0142194c995d5bfddb2dc42a7..952138001d5451671807fa6eb6be45b930db9eb3 100644
--- a/luci_config/appengine/backend/memcache/cache_test.go
+++ b/luci_config/appengine/backend/memcache/cache_test.go
@@ -20,7 +20,7 @@ import (
"github.com/luci/gae/filter/featureBreaker"
"github.com/luci/gae/impl/memory"
- mc "github.com/luci/gae/service/memcache"
+ "github.com/luci/gae/service/memcache"
"golang.org/x/net/context"
@@ -39,8 +39,8 @@ func TestMemcache(t *testing.T) {
c, mcFB := featureBreaker.FilterMC(c, nil)
- getMCStats := func(c context.Context) *mc.Statistics {
- st, err := mc.Stats(c)
+ getMCStats := func(c context.Context) *memcache.Statistics {
+ st, err := memcache.Stats(c)
if err != nil {
panic(err)
}
@@ -53,12 +53,12 @@ func TestMemcache(t *testing.T) {
},
}
- var be backend.B
- be = &client.Backend{
+ var be backend.B = &client.Backend{
Provider: &testconfig.Provider{
Base: memconfig.New(configDB),
},
}
+ mcURL := be.ServiceURL(c)
be = Backend(be, time.Minute)
c = backend.WithBackend(c, be)
@@ -102,14 +102,15 @@ func TestMemcache(t *testing.T) {
Convey(`When a cached entry is corrupted`, func() {
cacheKey := caching.Key{
- Schema: caching.Schema,
- Op: caching.OpGet,
- ConfigSet: "projects/foo",
- Path: "test.cfg",
- Content: true,
- Authority: backend.AsService,
+ Schema: caching.Schema,
+ ServiceURL: mcURL.String(),
+ Op: caching.OpGet,
+ ConfigSet: "projects/foo",
+ Path: "test.cfg",
+ Content: true,
+ Authority: backend.AsService,
}
- So(mc.Set(c, mc.NewItem(c, memcacheKey(&cacheKey)).SetValue([]byte("!!! trash !!!"))), ShouldBeNil)
+ So(memcache.Set(c, memcache.NewItem(c, memcacheKey(&cacheKey)).SetValue([]byte("!!! trash !!!"))), ShouldBeNil)
So(cfgclient.Get(c, cfgclient.AsService, "projects/foo", "test.cfg", cfgclient.String(&content), nil), ShouldBeNil)
So(content, ShouldEqual, "foo")
So(getMCStats(c).Misses, ShouldEqual, 0)
« no previous file with comments | « luci_config/appengine/backend/datastore/ds_test.go ('k') | luci_config/server/cfgclient/backend/caching/config.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698