test: fix failed ut

This commit is contained in:
Aaron Liu
2023-05-27 10:44:28 +08:00
parent 89ee147961
commit b1344616b8
8 changed files with 21 additions and 40 deletions

View File

@@ -16,13 +16,13 @@ func TestNewRedisStore(t *testing.T) {
store := NewRedisStore(10, "tcp", "", "", "0")
asserts.NotNil(store)
conn, err := store.pool.Dial()
asserts.Nil(conn)
asserts.Error(err)
asserts.Panics(func() {
store.pool.Dial()
})
testConn := redigomock.NewConn()
cmd := testConn.Command("PING").Expect("PONG")
err = store.pool.TestOnBorrow(testConn, time.Now())
err := store.pool.TestOnBorrow(testConn, time.Now())
if testConn.Stats(cmd) != 1 {
fmt.Println("Command was not used")
return