mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 08:32:40 +08:00
更新redis
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"testing"
|
||||
"time"
|
||||
@ -10,6 +11,19 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func RunOnSpecifiedRedis(t *testing.T, fn func(client redis.Client), addr ...string) {
|
||||
rdb := redis.New(&redis.ReidsOption{
|
||||
Addrs: addr,
|
||||
})
|
||||
defer rdb.Close()
|
||||
|
||||
if err := rdb.Ping(context.Background()).Err(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
fn(rdb)
|
||||
}
|
||||
|
||||
func RunOnRedis(t *testing.T, fn func(client redis.Client)) {
|
||||
redis, clean, err := createMiniRedis()
|
||||
assert.Nil(t, err)
|
||||
|
Reference in New Issue
Block a user