mirror of
https://github.com/openfaas/faas.git
synced 2025-06-21 14:23:25 +00:00
gateway/handlers: fix use of testing.T inside goroutine
Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
67598e58c5
commit
b4a6872c04
@ -122,13 +122,17 @@ func Test_logsProxyDoesNotLeakGoroutinesWhenClientClosesConnection(t *testing.T)
|
||||
t.Fatalf("unexpected error sending log request: %s", err)
|
||||
}
|
||||
|
||||
errCh := make(chan error, 1)
|
||||
go func() {
|
||||
defer resp.Body.Close()
|
||||
defer close(errCh)
|
||||
_, err := ioutil.ReadAll(resp.Body)
|
||||
if err != context.Canceled {
|
||||
t.Fatalf("unexpected error reading the response body: %s", err)
|
||||
}
|
||||
errCh <- err
|
||||
}()
|
||||
|
||||
cancel()
|
||||
err = <-errCh
|
||||
if err != context.Canceled {
|
||||
t.Fatalf("unexpected error reading the response body: %s", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user