add vendor

This commit is contained in:
deepzz0
2017-02-18 15:23:57 +08:00
parent 4ebbc38cc0
commit 562f4d86c6
1371 changed files with 369552 additions and 2 deletions
+48
View File
@@ -0,0 +1,48 @@
package cache
import (
"net"
"testing"
"time"
)
// These tests require redis server running on localhost:6379 (the default)
const redisTestServer = "localhost:6379"
var newRedisStore = func(t *testing.T, defaultExpiration time.Duration) CacheStore {
c, err := net.Dial("tcp", redisTestServer)
if err == nil {
c.Write([]byte("flush_all\r\n"))
c.Close()
redisCache := NewRedisCache(redisTestServer, "", defaultExpiration)
redisCache.Flush()
return redisCache
}
t.Errorf("couldn't connect to redis on %s", redisTestServer)
t.FailNow()
panic("")
}
func TestRedisCache_TypicalGetSet(t *testing.T) {
typicalGetSet(t, newRedisStore)
}
func TestRedisCache_IncrDecr(t *testing.T) {
incrDecr(t, newRedisStore)
}
func TestRedisCache_Expiration(t *testing.T) {
expiration(t, newRedisStore)
}
func TestRedisCache_EmptyCache(t *testing.T) {
emptyCache(t, newRedisStore)
}
func TestRedisCache_Replace(t *testing.T) {
testReplace(t, newRedisStore)
}
func TestRedisCache_Add(t *testing.T) {
testAdd(t, newRedisStore)
}