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