Files
timerx/cluster_test.go
T

49 lines
940 B
Go
Raw Permalink Normal View History

2023-11-27 22:37:33 +08:00
package timerx
2023-08-06 01:07:29 +08:00
import (
"fmt"
2023-08-27 23:39:58 +08:00
"testing"
"github.com/go-redis/redis/v8"
2023-08-06 01:07:29 +08:00
)
// 示例测试
2023-08-27 23:39:58 +08:00
// func exampleDemo(ctx context.Context) bool {
// fmt.Println("fff")
// return false
// }
// func ExampleB() {
// ctx := context.Background()
// timer.InitSingle(ctx)
// timer.AddToTimer(1, exampleDemo)
// // OutPut:
// }
func TestMain(m *testing.M) {
client := redis.NewClient(&redis.Options{
Addr: "127.0.0.1" + ":" + "6379",
Password: "", // no password set
DB: 0, // use default DB
})
if client == nil {
fmt.Println("redis init error")
return
}
2023-08-28 09:34:59 +08:00
// Redis = client
2023-08-27 23:39:58 +08:00
2023-08-06 01:07:29 +08:00
}
2023-08-27 23:39:58 +08:00
func TestRedis(t *testing.T) {
fmt.Println("6666")
2023-08-29 09:43:46 +08:00
t.Log("fffff")
2023-08-27 23:39:58 +08:00
// t.Fail()
// t.Error("ffff")
// Redis.Set(context.Background(), "dddd", "dddd", 0)
// str, err := Redis.Get(context.Background(), "dddd").Result()
// fmt.Println("ssss", str, err)
// t.Log(str, err)
// t.Fail()
2023-08-06 01:07:29 +08:00
}