fix issue 4311

This commit is contained in:
AllenX2018
2020-11-17 20:53:33 +08:00
parent 05d8e293f7
commit 6225f0c1e9
8 changed files with 136 additions and 31 deletions

View File

@@ -28,7 +28,6 @@ import (
)
func TestMemcacheCache(t *testing.T) {
addr := os.Getenv("MEMCACHE_ADDR")
if addr == "" {
addr = "127.0.0.1:11211"
@@ -114,6 +113,20 @@ func TestMemcacheCache(t *testing.T) {
t.Error("GetMulti ERROR")
}
vv, err = bm.GetMulti(context.Background(), []string{"astaxie0", "astaxie1"})
if len(vv) != 2 {
t.Error("GetMulti ERROR")
}
if vv[0] != nil {
t.Error("GetMulti ERROR")
}
if string(vv[1].([]byte)) != "author1" {
t.Error("GetMulti ERROR")
}
if err != nil && err.Error() == "key [astaxie0] error: key isn't exist" {
t.Error("GetMulti ERROR")
}
// test clear all
if err = bm.ClearAll(context.Background()); err != nil {
t.Error("clear all err")