mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
integration: add WaitGroup to prevent calling t.Fatalf after TestV3WatchCurrentPutOverlap function return
It could cause a panic when it happens Fixes #10886
This commit is contained in:
parent
9fba06ba3b
commit
d87bd2c87c
@ -479,8 +479,11 @@ func TestV3WatchCurrentPutOverlap(t *testing.T) {
|
|||||||
// last mod_revision that will be observed
|
// last mod_revision that will be observed
|
||||||
nrRevisions := 32
|
nrRevisions := 32
|
||||||
// first revision already allocated as empty revision
|
// first revision already allocated as empty revision
|
||||||
|
var wg sync.WaitGroup
|
||||||
for i := 1; i < nrRevisions; i++ {
|
for i := 1; i < nrRevisions; i++ {
|
||||||
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
kvc := toGRPC(clus.RandClient()).KV
|
kvc := toGRPC(clus.RandClient()).KV
|
||||||
req := &pb.PutRequest{Key: []byte("foo"), Value: []byte("bar")}
|
req := &pb.PutRequest{Key: []byte("foo"), Value: []byte("bar")}
|
||||||
if _, err := kvc.Put(context.TODO(), req); err != nil {
|
if _, err := kvc.Put(context.TODO(), req); err != nil {
|
||||||
@ -488,6 +491,7 @@ func TestV3WatchCurrentPutOverlap(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
// maps watcher to current expected revision
|
// maps watcher to current expected revision
|
||||||
progress := make(map[int64]int64)
|
progress := make(map[int64]int64)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user