update test

This commit is contained in:
siddontang 2014-05-16 09:10:09 +08:00
parent fb290a60b4
commit b2ec29083d
5 changed files with 7 additions and 28 deletions

View File

@ -26,9 +26,16 @@ func newTestRedisPool() {
} }
func getTestConn() redis.Conn { func getTestConn() redis.Conn {
startTestApp()
return testPool.Get() return testPool.Get()
} }
func getTestDB() *DB {
startTestApp()
return testApp.db
}
func startTestApp() { func startTestApp() {
f := func() { f := func() {
newTestRedisPool() newTestRedisPool()

View File

@ -8,8 +8,6 @@ import (
) )
func TestHash(t *testing.T) { func TestHash(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()
@ -82,8 +80,6 @@ func testHashArray(ay []interface{}, checkValues ...int) error {
} }
func TestHashM(t *testing.T) { func TestHashM(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()
@ -136,8 +132,6 @@ func TestHashM(t *testing.T) {
} }
func TestHashIncr(t *testing.T) { func TestHashIncr(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()
@ -175,8 +169,6 @@ func TestHashIncr(t *testing.T) {
} }
func TestHashGetAll(t *testing.T) { func TestHashGetAll(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()

View File

@ -6,8 +6,6 @@ import (
) )
func TestKV(t *testing.T) { func TestKV(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()
@ -77,8 +75,6 @@ func TestKV(t *testing.T) {
} }
func TestKVM(t *testing.T) { func TestKVM(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()
@ -108,8 +104,6 @@ func TestKVM(t *testing.T) {
} }
func TestKVIncrDecr(t *testing.T) { func TestKVIncrDecr(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()

View File

@ -54,8 +54,6 @@ func testListRange(key []byte, start int64, stop int64, checkValues ...int) erro
} }
func TestList(t *testing.T) { func TestList(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()
@ -199,7 +197,6 @@ func TestList(t *testing.T) {
} }
func TestListMPush(t *testing.T) { func TestListMPush(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()
@ -226,7 +223,6 @@ func TestListMPush(t *testing.T) {
} }
func TestPop(t *testing.T) { func TestPop(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()

View File

@ -57,8 +57,6 @@ func TestCodecZSet(t *testing.T) {
} }
func TestZSet(t *testing.T) { func TestZSet(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()
@ -156,8 +154,6 @@ func TestZSet(t *testing.T) {
} }
func TestZSetCount(t *testing.T) { func TestZSetCount(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()
@ -220,8 +216,6 @@ func TestZSetCount(t *testing.T) {
} }
func TestZSetRank(t *testing.T) { func TestZSetRank(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()
@ -279,8 +273,6 @@ func testZSetRange(ay []interface{}, checkValues ...interface{}) error {
} }
func TestZSetRangeScore(t *testing.T) { func TestZSetRangeScore(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()
@ -375,8 +367,6 @@ func TestZSetRangeScore(t *testing.T) {
} }
func TestZSetRange(t *testing.T) { func TestZSetRange(t *testing.T) {
startTestApp()
c := getTestConn() c := getTestConn()
defer c.Close() defer c.Close()