test & testutils: prevent goroutine leaks in test functions (#3133)
This commit is contained in:
@ -27,7 +27,7 @@ import (
|
||||
|
||||
func TestPipeListener(t *testing.T) {
|
||||
pl := testutils.NewPipeListener()
|
||||
recvdBytes := make(chan []byte)
|
||||
recvdBytes := make(chan []byte, 1)
|
||||
const want = "hello world"
|
||||
|
||||
go func() {
|
||||
|
@ -96,7 +96,7 @@ func TestConn(t *testing.T) {
|
||||
|
||||
func TestConnCloseWithData(t *testing.T) {
|
||||
lis := Listen(7)
|
||||
errChan := make(chan error)
|
||||
errChan := make(chan error, 1)
|
||||
var lisConn net.Conn
|
||||
go func() {
|
||||
var err error
|
||||
@ -199,7 +199,7 @@ func TestCloseWhileAccepting(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeadline(t *testing.T) {
|
||||
sig := make(chan error)
|
||||
sig := make(chan error, 2)
|
||||
blockingWrite := func(conn net.Conn) {
|
||||
_, err := conn.Write([]byte("0123456789"))
|
||||
sig <- err
|
||||
|
@ -4694,7 +4694,7 @@ func testClientResourceExhaustedCancelFullDuplex(t *testing.T, e env) {
|
||||
resp := &testpb.StreamingOutputCallResponse{
|
||||
Payload: payload,
|
||||
}
|
||||
ce := make(chan error)
|
||||
ce := make(chan error, 1)
|
||||
go func() {
|
||||
var err error
|
||||
for {
|
||||
|
Reference in New Issue
Block a user