make tests parallel

master
kevin 4 years ago
parent 2b1466e41e
commit 5e7b514ae2

@ -213,7 +213,10 @@ func TestTimingWheel_SetTimer(t *testing.T) {
} }
for _, test := range tests { for _, test := range tests {
test := test
t.Run(stringx.RandId(), func(t *testing.T) { t.Run(stringx.RandId(), func(t *testing.T) {
t.Parallel()
var count int32 var count int32
ticker := timex.NewFakeTicker() ticker := timex.NewFakeTicker()
tick := func() { tick := func() {
@ -291,7 +294,10 @@ func TestTimingWheel_SetAndMoveThenStart(t *testing.T) {
} }
for _, test := range tests { for _, test := range tests {
test := test
t.Run(stringx.RandId(), func(t *testing.T) { t.Run(stringx.RandId(), func(t *testing.T) {
t.Parallel()
var count int32 var count int32
ticker := timex.NewFakeTicker() ticker := timex.NewFakeTicker()
tick := func() { tick := func() {
@ -376,7 +382,10 @@ func TestTimingWheel_SetAndMoveTwice(t *testing.T) {
} }
for _, test := range tests { for _, test := range tests {
test := test
t.Run(stringx.RandId(), func(t *testing.T) { t.Run(stringx.RandId(), func(t *testing.T) {
t.Parallel()
var count int32 var count int32
ticker := timex.NewFakeTicker() ticker := timex.NewFakeTicker()
tick := func() { tick := func() {
@ -454,7 +463,10 @@ func TestTimingWheel_ElapsedAndSet(t *testing.T) {
} }
for _, test := range tests { for _, test := range tests {
test := test
t.Run(stringx.RandId(), func(t *testing.T) { t.Run(stringx.RandId(), func(t *testing.T) {
t.Parallel()
var count int32 var count int32
ticker := timex.NewFakeTicker() ticker := timex.NewFakeTicker()
tick := func() { tick := func() {
@ -542,7 +554,10 @@ func TestTimingWheel_ElapsedAndSetThenMove(t *testing.T) {
} }
for _, test := range tests { for _, test := range tests {
test := test
t.Run(stringx.RandId(), func(t *testing.T) { t.Run(stringx.RandId(), func(t *testing.T) {
t.Parallel()
var count int32 var count int32
ticker := timex.NewFakeTicker() ticker := timex.NewFakeTicker()
tick := func() { tick := func() {

@ -54,6 +54,7 @@ func TestP2cPicker_Pick(t *testing.T) {
test := test test := test
t.Run(test.name, func(t *testing.T) { t.Run(test.name, func(t *testing.T) {
t.Parallel() t.Parallel()
const total = 100000 const total = 100000
builder := new(p2cPickerBuilder) builder := new(p2cPickerBuilder)
ready := make(map[resolver.Address]balancer.SubConn) ready := make(map[resolver.Address]balancer.SubConn)

Loading…
Cancel
Save