From a722cde148fb268d6a0e9e66792b84ca6983cd80 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Sat, 5 Sep 2020 11:34:37 +0300 Subject: [PATCH 1/2] Remove ClusterClient failover tests --- cluster_test.go | 59 +++---------------------------------------------- export_test.go | 1 + options.go | 2 +- 3 files changed, 5 insertions(+), 57 deletions(-) diff --git a/cluster_test.go b/cluster_test.go index 5c125de6..9cb41173 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -47,7 +47,7 @@ func (s *clusterScenario) addrs() []string { return addrs } -func (s *clusterScenario) newClusterClientUnsafe(opt *redis.ClusterOptions) *redis.ClusterClient { +func (s *clusterScenario) newClusterClientUnstable(opt *redis.ClusterOptions) *redis.ClusterClient { opt.Addrs = s.addrs() return redis.NewClusterClient(opt) } @@ -55,7 +55,7 @@ func (s *clusterScenario) newClusterClientUnsafe(opt *redis.ClusterOptions) *red func (s *clusterScenario) newClusterClient( ctx context.Context, opt *redis.ClusterOptions, ) *redis.ClusterClient { - client := s.newClusterClientUnsafe(opt) + client := s.newClusterClientUnstable(opt) err := eventually(func() error { if opt.ClusterSlots != nil { @@ -873,59 +873,6 @@ var _ = Describe("ClusterClient", func() { assertClusterClient() }) - Describe("ClusterClient failover", func() { - BeforeEach(func() { - failover = true - - opt = redisClusterOptions() - opt.MinRetryBackoff = 250 * time.Millisecond - opt.MaxRetryBackoff = time.Second - client = cluster.newClusterClient(ctx, opt) - - err := client.ForEachMaster(ctx, func(ctx context.Context, master *redis.Client) error { - return master.FlushDB(ctx).Err() - }) - Expect(err).NotTo(HaveOccurred()) - - err = client.ForEachSlave(ctx, func(ctx context.Context, slave *redis.Client) error { - defer GinkgoRecover() - - Eventually(func() int64 { - return slave.DBSize(ctx).Val() - }, "30s").Should(Equal(int64(0))) - - return nil - }) - Expect(err).NotTo(HaveOccurred()) - - state, err := client.LoadState(ctx) - Eventually(func() bool { - state, err = client.LoadState(ctx) - if err != nil { - return false - } - return state.IsConsistent(ctx) - }, "30s").Should(BeTrue()) - - for _, slave := range state.Slaves { - err = slave.Client.ClusterFailover(ctx).Err() - Expect(err).NotTo(HaveOccurred()) - - Eventually(func() bool { - state, _ := client.LoadState(ctx) - return state.IsConsistent(ctx) - }, "30s").Should(BeTrue()) - } - }) - - AfterEach(func() { - failover = false - Expect(client.Close()).NotTo(HaveOccurred()) - }) - - assertClusterClient() - }) - Describe("ClusterClient with RouteByLatency", func() { BeforeEach(func() { opt = redisClusterOptions() @@ -1132,7 +1079,7 @@ var _ = Describe("ClusterClient with unavailable Cluster", func() { opt.ReadTimeout = 250 * time.Millisecond opt.WriteTimeout = 250 * time.Millisecond opt.MaxRedirects = 1 - client = cluster.newClusterClientUnsafe(opt) + client = cluster.newClusterClientUnstable(opt) }) AfterEach(func() { diff --git a/export_test.go b/export_test.go index ede8b304..d4c2de8c 100644 --- a/export_test.go +++ b/export_test.go @@ -19,6 +19,7 @@ func (c *PubSub) SetNetConn(netConn net.Conn) { } func (c *ClusterClient) LoadState(ctx context.Context) (*clusterState, error) { + // return c.state.Reload(ctx) return c.loadState(ctx) } diff --git a/options.go b/options.go index 7ce0aef5..b44e44cb 100644 --- a/options.go +++ b/options.go @@ -254,7 +254,7 @@ func newConnPool(opt *Options) *pool.ConnPool { ) conn, err = opt.Dialer(ctx, opt.Network, opt.Addr) if err != nil { - internal.RecordError(ctx, err) + _ = internal.RecordError(ctx, err) } return err }) From 2bf7ec6cfec06b1b1b32e12c34961832555947cf Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Sat, 5 Sep 2020 12:16:45 +0300 Subject: [PATCH 2/2] Test on Go 1.15 --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index ffc5fd7f..adedd8df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,18 +5,14 @@ services: - redis-server go: - - 1.12.x - - 1.13.x - 1.14.x + - 1.15.x - tip matrix: allow_failures: - go: tip -env: - - GO111MODULE=on - go_import_path: github.com/go-redis/redis before_install: