We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 61830e9 commit 631c152Copy full SHA for 631c152
websocket_test.go
@@ -485,19 +485,14 @@ func TestHandshake(t *testing.T) {
485
}
486
defer c.Close(websocket.StatusInternalError, "")
487
488
- pctx := c.Context(ctx)
+ cctx := c.Context(ctx)
489
490
- for ctx.Err() == nil {
491
- err = c.Ping(ctx)
492
- if err != nil {
493
- if pctx.Err() == nil {
494
- return xerrors.Errorf("context from c.Context not cancelled when connection broken")
495
- }
496
- return nil
497
+ select {
+ case <-ctx.Done():
+ return xerrors.Errorf("child context never cancelled")
+ case <-cctx.Done():
+ return nil
498
499
-
500
- return xerrors.Errorf("all pings succeeded")
501
},
502
503
0 commit comments