From 5e7b514ae25df8f1cf8ddcfa05baaa2a4abd203b Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 21 Aug 2020 23:15:45 +0800 Subject: [PATCH] make tests parallel --- core/collection/timingwheel_test.go | 15 +++++++++++++++ rpcx/internal/balancer/p2c/p2c_test.go | 1 + 2 files changed, 16 insertions(+) diff --git a/core/collection/timingwheel_test.go b/core/collection/timingwheel_test.go index 225a11c8..d85955fa 100644 --- a/core/collection/timingwheel_test.go +++ b/core/collection/timingwheel_test.go @@ -213,7 +213,10 @@ func TestTimingWheel_SetTimer(t *testing.T) { } for _, test := range tests { + test := test t.Run(stringx.RandId(), func(t *testing.T) { + t.Parallel() + var count int32 ticker := timex.NewFakeTicker() tick := func() { @@ -291,7 +294,10 @@ func TestTimingWheel_SetAndMoveThenStart(t *testing.T) { } for _, test := range tests { + test := test t.Run(stringx.RandId(), func(t *testing.T) { + t.Parallel() + var count int32 ticker := timex.NewFakeTicker() tick := func() { @@ -376,7 +382,10 @@ func TestTimingWheel_SetAndMoveTwice(t *testing.T) { } for _, test := range tests { + test := test t.Run(stringx.RandId(), func(t *testing.T) { + t.Parallel() + var count int32 ticker := timex.NewFakeTicker() tick := func() { @@ -454,7 +463,10 @@ func TestTimingWheel_ElapsedAndSet(t *testing.T) { } for _, test := range tests { + test := test t.Run(stringx.RandId(), func(t *testing.T) { + t.Parallel() + var count int32 ticker := timex.NewFakeTicker() tick := func() { @@ -542,7 +554,10 @@ func TestTimingWheel_ElapsedAndSetThenMove(t *testing.T) { } for _, test := range tests { + test := test t.Run(stringx.RandId(), func(t *testing.T) { + t.Parallel() + var count int32 ticker := timex.NewFakeTicker() tick := func() { diff --git a/rpcx/internal/balancer/p2c/p2c_test.go b/rpcx/internal/balancer/p2c/p2c_test.go index 163ba934..c3043db9 100644 --- a/rpcx/internal/balancer/p2c/p2c_test.go +++ b/rpcx/internal/balancer/p2c/p2c_test.go @@ -54,6 +54,7 @@ func TestP2cPicker_Pick(t *testing.T) { test := test t.Run(test.name, func(t *testing.T) { t.Parallel() + const total = 100000 builder := new(p2cPickerBuilder) ready := make(map[resolver.Address]balancer.SubConn)