in multiple packages: fixed goroutine leak bugs in tests (#11569)
parent
53f15caf73
commit
cad92706cf
|
@ -710,7 +710,7 @@ func TestKVGetRetry(t *testing.T) {
|
|||
|
||||
clus.Members[fIdx].Stop(t)
|
||||
|
||||
donec := make(chan struct{})
|
||||
donec := make(chan struct{}, 1)
|
||||
go func() {
|
||||
// Get will fail, but reconnect will trigger
|
||||
gresp, gerr := kv.Get(ctx, "foo")
|
||||
|
|
|
@ -119,7 +119,7 @@ func TestTxnReadRetry(t *testing.T) {
|
|||
clus.Members[0].Stop(t)
|
||||
<-clus.Members[0].StopNotify()
|
||||
|
||||
donec := make(chan struct{})
|
||||
donec := make(chan struct{}, 1)
|
||||
go func() {
|
||||
_, err := kv.Txn(context.TODO()).Then(thenOps[i]...).Commit()
|
||||
if err != nil {
|
||||
|
|
|
@ -838,7 +838,7 @@ func TestSync(t *testing.T) {
|
|||
srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}
|
||||
|
||||
// check that sync is non-blocking
|
||||
done := make(chan struct{})
|
||||
done := make(chan struct{}, 1)
|
||||
go func() {
|
||||
srv.sync(10 * time.Second)
|
||||
done <- struct{}{}
|
||||
|
@ -883,7 +883,7 @@ func TestSyncTimeout(t *testing.T) {
|
|||
srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}
|
||||
|
||||
// check that sync is non-blocking
|
||||
done := make(chan struct{})
|
||||
done := make(chan struct{}, 1)
|
||||
go func() {
|
||||
srv.sync(0)
|
||||
done <- struct{}{}
|
||||
|
|
|
@ -662,7 +662,7 @@ func TestConcurrentReadNotBlockingWrite(t *testing.T) {
|
|||
readTx1 := s.Read(traceutil.TODO())
|
||||
|
||||
// write should not be blocked by reads
|
||||
done := make(chan struct{})
|
||||
done := make(chan struct{}, 1)
|
||||
go func() {
|
||||
s.Put([]byte("foo"), []byte("newBar"), lease.NoLease) // this is a write Txn
|
||||
done <- struct{}{}
|
||||
|
|
|
@ -355,7 +355,7 @@ func TestWatcherWatchWithFilter(t *testing.T) {
|
|||
}
|
||||
|
||||
w.Watch(0, []byte("foo"), nil, 0, filterPut)
|
||||
done := make(chan struct{})
|
||||
done := make(chan struct{}, 1)
|
||||
|
||||
go func() {
|
||||
<-w.Chan()
|
||||
|
|
Loading…
Reference in New Issue