all: fix goroutine leaks in unit tests by adding 1-elem channel buffer (#20666)

This fixes a bunch of cases where a timeout in the test would leak
a goroutine.
This commit is contained in:
Boqin Qin
2020-02-18 00:33:12 +08:00
committed by GitHub
parent 57d4898e29
commit 1b9c5b393b
4 changed files with 4 additions and 4 deletions

View File

@ -550,7 +550,7 @@ func TestServerInboundThrottle(t *testing.T) {
conn.Close()
// Dial again. This time the server should close the connection immediately.
connClosed := make(chan struct{})
connClosed := make(chan struct{}, 1)
conn, err = net.DialTimeout("tcp", srv.ListenAddr, timeout)
if err != nil {
t.Fatalf("could not dial: %v", err)