diff options
| author | Sina Siadat <siadat@gmail.com> | 2017-10-17 13:50:26 +0330 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2017-11-10 06:04:37 +0000 |
| commit | 2a668e2467ddea57e8a1ab2859cfd49e6ab2dd40 (patch) | |
| tree | 45160ac5b99121f487960fd37aef42d0261da40c | |
| parent | e49bc465a3acb2dd72e9afa5d40e541205c7d460 (diff) | |
| download | go-2a668e2467ddea57e8a1ab2859cfd49e6ab2dd40.tar.xz | |
net/http: simplify ctx.Err() call in test
See CL 40291. ctx.Err() is defined to only return non-nil exactly
when ctx.Done() returns a closed channel.
Change-Id: I12f51d8c42228f759273319b3ccc28012cb9fc73
Reviewed-on: https://go-review.googlesource.com/71310
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
| -rw-r--r-- | src/net/http/serve_test.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go index 508d8b53f1..b000bf0e61 100644 --- a/src/net/http/serve_test.go +++ b/src/net/http/serve_test.go @@ -686,12 +686,8 @@ func TestHTTP2WriteDeadlineExtendedOnNewRequest(t *testing.T) { req = req.WithContext(ctx) r, err := c.Do(req) - select { - case <-ctx.Done(): - if ctx.Err() == context.DeadlineExceeded { - t.Fatalf("http2 Get #%d response timed out", i) - } - default: + if ctx.Err() == context.DeadlineExceeded { + t.Fatalf("http2 Get #%d response timed out", i) } if err != nil { t.Fatalf("http2 Get #%d: %v", i, err) |
