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/prod/everything_test.go

Issue 1541183002: Make setting a Memcache Item with a nil Value OK (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: Created 5 years 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_test.go ('k') | impl/prod/memcache.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/prod/everything_test.go
diff --git a/impl/prod/everything_test.go b/impl/prod/everything_test.go
index 9f2eb2fd1fe887f517b92069f12e400566cef698..d94a7ecb572dec15ea395032fc847d2e61fc2b61 100644
--- a/impl/prod/everything_test.go
+++ b/impl/prod/everything_test.go
@@ -13,6 +13,7 @@ import (
"github.com/luci/gae/service/blobstore"
"github.com/luci/gae/service/datastore"
"github.com/luci/gae/service/info"
+ "github.com/luci/gae/service/memcache"
"github.com/luci/luci-go/common/logging"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
@@ -52,6 +53,7 @@ func TestBasicDatastore(t *testing.T) {
ctx := Use(context.Background(), req)
ds := datastore.Get(ctx)
+ mc := memcache.Get(ctx)
inf := info.Get(ctx)
// You have to visually confirm that this actually happens in the stdout
@@ -214,5 +216,13 @@ func TestBasicDatastore(t *testing.T) {
So(ds.Get(&ent), ShouldBeNil)
So(ent["Time"], ShouldResemble, pm["Time"])
})
+
+ Convey("memcache: Set (nil) is the same as Set ([]byte{})", func() {
+ So(mc.Set(mc.NewItem("bob")), ShouldBeNil) // normally would panic because Value is nil
+
+ bob, err := mc.Get("bob")
+ So(err, ShouldBeNil)
+ So(bob.Value(), ShouldResemble, []byte{})
+ })
})
}
« no previous file with comments | « impl/memory/memcache_test.go ('k') | impl/prod/memcache.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698