mirror of
https://github.com/openfaas/faas.git
synced 2025-06-23 07:13:23 +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)
|
t.Fatalf("unexpected error sending log request: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errCh := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
defer close(errCh)
|
||||||
_, err := ioutil.ReadAll(resp.Body)
|
_, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != context.Canceled {
|
errCh <- err
|
||||||
t.Fatalf("unexpected error reading the response body: %s", err)
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
cancel()
|
cancel()
|
||||||
|
err = <-errCh
|
||||||
|
if err != context.Canceled {
|
||||||
|
t.Fatalf("unexpected error reading the response body: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user