fix golint issues in core/collection, refine cache interface (#475)

This commit is contained in:
Kevin Wan
2021-02-18 15:49:56 +08:00
committed by GitHub
parent f14ab70035
commit 457048bfac
14 changed files with 139 additions and 89 deletions

View File

@@ -34,7 +34,7 @@ func TestCollection_Count(t *testing.T) {
assert.Nil(t, err)
defer clean()
cach := cache.NewCacheNode(r, sharedCalls, stats, mgo.ErrNotFound)
cach := cache.NewNode(r, sharedCalls, stats, mgo.ErrNotFound)
c := newCollection(dummyConn{}, cach)
val, err := c.Count("any")
assert.Nil(t, err)
@@ -98,7 +98,7 @@ func TestStat(t *testing.T) {
assert.Nil(t, err)
defer clean()
cach := cache.NewCacheNode(r, sharedCalls, stats, mgo.ErrNotFound)
cach := cache.NewNode(r, sharedCalls, stats, mgo.ErrNotFound)
c := newCollection(dummyConn{}, cach)
for i := 0; i < 10; i++ {
@@ -121,7 +121,7 @@ func TestStatCacheFails(t *testing.T) {
defer log.SetOutput(os.Stdout)
r := redis.NewRedis("localhost:59999", redis.NodeType)
cach := cache.NewCacheNode(r, sharedCalls, stats, mgo.ErrNotFound)
cach := cache.NewNode(r, sharedCalls, stats, mgo.ErrNotFound)
c := newCollection(dummyConn{}, cach)
for i := 0; i < 20; i++ {
@@ -142,7 +142,7 @@ func TestStatDbFails(t *testing.T) {
assert.Nil(t, err)
defer clean()
cach := cache.NewCacheNode(r, sharedCalls, stats, mgo.ErrNotFound)
cach := cache.NewNode(r, sharedCalls, stats, mgo.ErrNotFound)
c := newCollection(dummyConn{}, cach)
for i := 0; i < 20; i++ {
@@ -164,7 +164,7 @@ func TestStatFromMemory(t *testing.T) {
assert.Nil(t, err)
defer clean()
cach := cache.NewCacheNode(r, sharedCalls, stats, mgo.ErrNotFound)
cach := cache.NewNode(r, sharedCalls, stats, mgo.ErrNotFound)
c := newCollection(dummyConn{}, cach)
var all sync.WaitGroup