1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 08:32:40 +08:00

更新redis

This commit is contained in:
2023-10-13 10:52:36 +08:00
parent e83db7daee
commit d1c269ed90
8 changed files with 48 additions and 42 deletions

View File

@ -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)