Skip to content

Commit a722cde

Browse files
committed
Remove ClusterClient failover tests
1 parent fe55405 commit a722cde

File tree

3 files changed

+5
-57
lines changed

3 files changed

+5
-57
lines changed

cluster_test.go

Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ func (s *clusterScenario) addrs() []string {
4747
return addrs
4848
}
4949

50-
func (s *clusterScenario) newClusterClientUnsafe(opt *redis.ClusterOptions) *redis.ClusterClient {
50+
func (s *clusterScenario) newClusterClientUnstable(opt *redis.ClusterOptions) *redis.ClusterClient {
5151
opt.Addrs = s.addrs()
5252
return redis.NewClusterClient(opt)
5353
}
5454

5555
func (s *clusterScenario) newClusterClient(
5656
ctx context.Context, opt *redis.ClusterOptions,
5757
) *redis.ClusterClient {
58-
client := s.newClusterClientUnsafe(opt)
58+
client := s.newClusterClientUnstable(opt)
5959

6060
err := eventually(func() error {
6161
if opt.ClusterSlots != nil {
@@ -873,59 +873,6 @@ var _ = Describe("ClusterClient", func() {
873873
assertClusterClient()
874874
})
875875

876-
Describe("ClusterClient failover", func() {
877-
BeforeEach(func() {
878-
failover = true
879-
880-
opt = redisClusterOptions()
881-
opt.MinRetryBackoff = 250 * time.Millisecond
882-
opt.MaxRetryBackoff = time.Second
883-
client = cluster.newClusterClient(ctx, opt)
884-
885-
err := client.ForEachMaster(ctx, func(ctx context.Context, master *redis.Client) error {
886-
return master.FlushDB(ctx).Err()
887-
})
888-
Expect(err).NotTo(HaveOccurred())
889-
890-
err = client.ForEachSlave(ctx, func(ctx context.Context, slave *redis.Client) error {
891-
defer GinkgoRecover()
892-
893-
Eventually(func() int64 {
894-
return slave.DBSize(ctx).Val()
895-
}, "30s").Should(Equal(int64(0)))
896-
897-
return nil
898-
})
899-
Expect(err).NotTo(HaveOccurred())
900-
901-
state, err := client.LoadState(ctx)
902-
Eventually(func() bool {
903-
state, err = client.LoadState(ctx)
904-
if err != nil {
905-
return false
906-
}
907-
return state.IsConsistent(ctx)
908-
}, "30s").Should(BeTrue())
909-
910-
for _, slave := range state.Slaves {
911-
err = slave.Client.ClusterFailover(ctx).Err()
912-
Expect(err).NotTo(HaveOccurred())
913-
914-
Eventually(func() bool {
915-
state, _ := client.LoadState(ctx)
916-
return state.IsConsistent(ctx)
917-
}, "30s").Should(BeTrue())
918-
}
919-
})
920-
921-
AfterEach(func() {
922-
failover = false
923-
Expect(client.Close()).NotTo(HaveOccurred())
924-
})
925-
926-
assertClusterClient()
927-
})
928-
929876
Describe("ClusterClient with RouteByLatency", func() {
930877
BeforeEach(func() {
931878
opt = redisClusterOptions()
@@ -1132,7 +1079,7 @@ var _ = Describe("ClusterClient with unavailable Cluster", func() {
11321079
opt.ReadTimeout = 250 * time.Millisecond
11331080
opt.WriteTimeout = 250 * time.Millisecond
11341081
opt.MaxRedirects = 1
1135-
client = cluster.newClusterClientUnsafe(opt)
1082+
client = cluster.newClusterClientUnstable(opt)
11361083
})
11371084

11381085
AfterEach(func() {

export_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func (c *PubSub) SetNetConn(netConn net.Conn) {
1919
}
2020

2121
func (c *ClusterClient) LoadState(ctx context.Context) (*clusterState, error) {
22+
// return c.state.Reload(ctx)
2223
return c.loadState(ctx)
2324
}
2425

options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func newConnPool(opt *Options) *pool.ConnPool {
254254
)
255255
conn, err = opt.Dialer(ctx, opt.Network, opt.Addr)
256256
if err != nil {
257-
internal.RecordError(ctx, err)
257+
_ = internal.RecordError(ctx, err)
258258
}
259259
return err
260260
})

0 commit comments

Comments
 (0)