2017-02-17 13:12:06 +03:00
|
|
|
package redis_test
|
|
|
|
|
|
|
|
import (
|
2023-01-27 18:00:49 +03:00
|
|
|
. "github.com/bsm/ginkgo/v2"
|
|
|
|
. "github.com/bsm/gomega"
|
2017-02-17 13:12:06 +03:00
|
|
|
|
2023-01-23 09:48:54 +03:00
|
|
|
"github.com/redis/go-redis/v9"
|
2017-02-17 13:12:06 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("UniversalClient", func() {
|
|
|
|
var client redis.UniversalClient
|
|
|
|
|
|
|
|
AfterEach(func() {
|
|
|
|
if client != nil {
|
|
|
|
Expect(client.Close()).To(Succeed())
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
It("should connect to failover servers", func() {
|
2023-09-10 15:43:22 +03:00
|
|
|
Skip("Flaky Test")
|
2017-02-17 13:12:06 +03:00
|
|
|
client = redis.NewUniversalClient(&redis.UniversalOptions{
|
|
|
|
MasterName: sentinelName,
|
2020-09-03 22:11:56 +03:00
|
|
|
Addrs: sentinelAddrs,
|
2017-02-17 13:12:06 +03:00
|
|
|
})
|
2020-03-11 17:26:42 +03:00
|
|
|
Expect(client.Ping(ctx).Err()).NotTo(HaveOccurred())
|
2017-02-17 13:12:06 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
It("should connect to simple servers", func() {
|
|
|
|
client = redis.NewUniversalClient(&redis.UniversalOptions{
|
|
|
|
Addrs: []string{redisAddr},
|
|
|
|
})
|
2020-03-11 17:26:42 +03:00
|
|
|
Expect(client.Ping(ctx).Err()).NotTo(HaveOccurred())
|
2017-02-17 13:12:06 +03:00
|
|
|
})
|
|
|
|
|
2024-01-01 23:19:22 +03:00
|
|
|
It("should connect to clusters", Label("NonRedisEnterprise"), func() {
|
2017-02-17 13:12:06 +03:00
|
|
|
client = redis.NewUniversalClient(&redis.UniversalOptions{
|
|
|
|
Addrs: cluster.addrs(),
|
|
|
|
})
|
2020-03-11 17:26:42 +03:00
|
|
|
Expect(client.Ping(ctx).Err()).NotTo(HaveOccurred())
|
2017-02-17 13:12:06 +03:00
|
|
|
})
|
|
|
|
})
|