in multiple packages: fixed goroutine leak bugs in tests (#11569)

release-3.5
sfzhu93 2020-01-30 13:45:59 -05:00 committed by GitHub
parent 53f15caf73
commit cad92706cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 6 deletions

View File

@ -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")

View File

@ -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 {

View File

@ -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{}{}

View File

@ -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{}{}

View File

@ -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()