|
|
@ -29,6 +29,7 @@ func init() {
|
|
|
|
func TestCacheNode_DelCache(t *testing.T) {
|
|
|
|
func TestCacheNode_DelCache(t *testing.T) {
|
|
|
|
store, clean, err := redistest.CreateRedis()
|
|
|
|
store, clean, err := redistest.CreateRedis()
|
|
|
|
assert.Nil(t, err)
|
|
|
|
assert.Nil(t, err)
|
|
|
|
|
|
|
|
store.Type = redis.ClusterType
|
|
|
|
defer clean()
|
|
|
|
defer clean()
|
|
|
|
|
|
|
|
|
|
|
|
cn := cacheNode{
|
|
|
|
cn := cacheNode{
|
|
|
@ -49,6 +50,23 @@ func TestCacheNode_DelCache(t *testing.T) {
|
|
|
|
assert.Nil(t, cn.Del("first", "second"))
|
|
|
|
assert.Nil(t, cn.Del("first", "second"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestCacheNode_DelCacheWithErrors(t *testing.T) {
|
|
|
|
|
|
|
|
store, clean, err := redistest.CreateRedis()
|
|
|
|
|
|
|
|
assert.Nil(t, err)
|
|
|
|
|
|
|
|
store.Type = redis.ClusterType
|
|
|
|
|
|
|
|
clean()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cn := cacheNode{
|
|
|
|
|
|
|
|
rds: store,
|
|
|
|
|
|
|
|
r: rand.New(rand.NewSource(time.Now().UnixNano())),
|
|
|
|
|
|
|
|
lock: new(sync.Mutex),
|
|
|
|
|
|
|
|
unstableExpiry: mathx.NewUnstable(expiryDeviation),
|
|
|
|
|
|
|
|
stat: NewStat("any"),
|
|
|
|
|
|
|
|
errNotFound: errTestNotFound,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.Nil(t, cn.Del("third", "fourth"))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestCacheNode_InvalidCache(t *testing.T) {
|
|
|
|
func TestCacheNode_InvalidCache(t *testing.T) {
|
|
|
|
s, err := miniredis.Run()
|
|
|
|
s, err := miniredis.Run()
|
|
|
|
assert.Nil(t, err)
|
|
|
|
assert.Nil(t, err)
|
|
|
|