waitForGoAwayTooManyPings waits for client to receive a GoAwayTooManyPings from server. It also asserts that stream creation fails after receiving a GoAway.
(client *http2Client)
| 842 | // from server. It also asserts that stream creation fails after receiving a |
| 843 | // GoAway. |
| 844 | func waitForGoAwayTooManyPings(client *http2Client) error { |
| 845 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 846 | defer cancel() |
| 847 | select { |
| 848 | case <-client.GoAway(): |
| 849 | if reason, _ := client.GetGoAwayReason(); reason != GoAwayTooManyPings { |
| 850 | return fmt.Errorf("goAwayReason is %v, want %v", reason, GoAwayTooManyPings) |
| 851 | } |
| 852 | case <-ctx.Done(): |
| 853 | return fmt.Errorf("test timed out before getting GoAway with reason:GoAwayTooManyPings from server") |
| 854 | } |
| 855 | |
| 856 | if _, err := client.NewStream(ctx, &CallHdr{}, nil); err == nil { |
| 857 | return fmt.Errorf("stream creation succeeded after receiving a GoAway from the server") |
| 858 | } |
| 859 | return nil |
| 860 | } |
no test coverage detected