Skip to content

Commit bda32aa

Browse files
committed
Run Member{Add,Remove} tests in parallel
On my local machine it brings down execution time from 5m to 32s. Issue: etcd-io#18983 Signed-off-by: Aleksander Mistewicz <[email protected]>
1 parent 39d9cd7 commit bda32aa

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tests/common/member_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ func TestMemberList(t *testing.T) {
3434

3535
for _, tc := range clusterTestCases() {
3636
t.Run(tc.name, func(t *testing.T) {
37+
t.Parallel()
38+
3739
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
3840
defer cancel()
3941
clus := testRunner.NewCluster(ctx, t, config.WithClusterConfig(tc.config))
@@ -113,6 +115,8 @@ func TestMemberAdd(t *testing.T) {
113115
for _, quorumTc := range quorumTcs {
114116
for _, clusterTc := range clusterTestCases() {
115117
t.Run(learnerTc.name+"/"+quorumTc.name+"/"+clusterTc.name, func(t *testing.T) {
118+
t.Parallel()
119+
116120
ctxTimeout := 10 * time.Second
117121
if quorumTc.waitForQuorum {
118122
ctxTimeout += etcdserver.HealthInterval
@@ -198,6 +202,8 @@ func TestMemberRemove(t *testing.T) {
198202
continue
199203
}
200204
t.Run(quorumTc.name+"/"+clusterTc.name, func(t *testing.T) {
205+
t.Parallel()
206+
201207
ctx, cancel := context.WithTimeout(context.Background(), 14*time.Second)
202208
defer cancel()
203209
c := clusterTc.config

tests/framework/e2e/e2e.go

+4
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ package e2e
1717
import (
1818
"context"
1919
"os"
20+
"sync/atomic"
2021
"testing"
2122

2223
"go.etcd.io/etcd/client/pkg/v3/testutil"
2324
"go.etcd.io/etcd/tests/v3/framework/config"
2425
intf "go.etcd.io/etcd/tests/v3/framework/interfaces"
2526
)
2627

28+
var uniqueCount int32 = 20000
29+
2730
type e2eRunner struct{}
2831

2932
func NewE2eRunner() intf.TestRunner {
@@ -83,6 +86,7 @@ func (e e2eRunner) NewCluster(ctx context.Context, t testing.TB, opts ...config.
8386
default:
8487
t.Fatalf("PeerTLS config %q not supported", cfg.PeerTLS)
8588
}
89+
e2eConfig.BasePort = 11000 + int(atomic.AddInt32(&uniqueCount, int32(cfg.ClusterSize+2)*5)%8000)
8690
epc, err := NewEtcdProcessCluster(ctx, t, WithConfig(e2eConfig))
8791
if err != nil {
8892
t.Fatalf("could not start etcd integrationCluster: %s", err)

0 commit comments

Comments
 (0)