From f4ae0ba02b0110469f61f27d2e2246cd82cae797 Mon Sep 17 00:00:00 2001 From: monkey Date: Thu, 25 Feb 2021 11:43:41 +0800 Subject: [PATCH] solve possible unit test errors in ring_test.go /redis/ring_test.go:560, Expected: : 10, to equal: : 9 /redis/ring_test.go:560, Expected: : 1, to equal: : 0 Signed-off-by: monkey --- ring_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ring_test.go b/ring_test.go index 0017aed6..6ec1ff84 100644 --- a/ring_test.go +++ b/ring_test.go @@ -533,6 +533,16 @@ var _ = Describe("Ring watch", func() { }) It("respects max size on multi", func() { + //this test checks the number of "pool.conn" + //if the health check is performed at the same time + //conn will be used, resulting in an abnormal number of "pool.conn". + // + //redis.NewRing() does not have an option to prohibit health checks. + //set a relatively large time here to avoid health checks. + opt := redisRingOptions() + opt.HeartbeatFrequency = 72 * time.Hour + ring = redis.NewRing(opt) + perform(1000, func(id int) { var ping *redis.StatusCmd