e2e: submitConcurrentWatch runs with ExecuteWithTimeout
Use testutils.ExecuteWithTimeout to make sure that the all active
streams are ready in time.
@@ -28,6 +28,7 @@ import (
pb "go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/client/pkg/v3/testutil"
"go.etcd.io/etcd/tests/v3/framework/e2e"
+ "go.etcd.io/etcd/tests/v3/framework/testutils"
)
// NO TLS
@@ -183,7 +184,9 @@ func submitConcurrentWatch(cx ctlCtx, number int, wgDone *sync.WaitGroup, closeC
return nil
}
+ testutils.ExecuteWithTimeout(cx.t, cx.getTestTimeout(), func() {
wgSchedule.Add(number)
+
for i := 0; i < number; i++ {
go func(i int) {
defer wgDone.Done()
@@ -191,11 +194,12 @@ func submitConcurrentWatch(cx ctlCtx, number int, wgDone *sync.WaitGroup, closeC
if err := createWatchConnection(); err != nil {
cx.t.Fatalf("testV3CurlMaxStream watch failed: %d, error: %v", i, err)
}
-
}(i)
}
+
// make sure all goroutines have already been scheduled.
wgSchedule.Wait()
+ })
}
func submitRangeAfterConcurrentWatch(cx ctlCtx, expectedValue string) {
