forked from redis/go-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
universal_test.go
40 lines (33 loc) · 931 Bytes
/
universal_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package redis_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
)
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() {
client = redis.NewUniversalClient(&redis.UniversalOptions{
MasterName: sentinelName,
Addrs: sentinelAddrs,
})
Expect(client.Ping(ctx).Err()).NotTo(HaveOccurred())
})
It("should connect to simple servers", func() {
client = redis.NewUniversalClient(&redis.UniversalOptions{
Addrs: []string{redisAddr},
})
Expect(client.Ping(ctx).Err()).NotTo(HaveOccurred())
})
It("should connect to clusters", func() {
client = redis.NewUniversalClient(&redis.UniversalOptions{
Addrs: cluster.addrs(),
})
Expect(client.Ping(ctx).Err()).NotTo(HaveOccurred())
})
})