Skip to content

Commit

Permalink
internal: fix flaky test KeepaliveClientStaysHealthyWithResponsiveSer…
Browse files Browse the repository at this point in the history
…ver (#4427)

Server should allow `NoStream`, otherwise there's a small chance
(5/1000) the connection will be closed due to `too many pings`.
  • Loading branch information
menghanl authored May 13, 2021
1 parent 6fea90d commit a16b156
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions internal/transport/keepalive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,19 @@ func (s) TestKeepaliveClientClosesWithActiveStreams(t *testing.T) {
// responds to keepalive pings, and makes sure than a client transport stays
// healthy without any active streams.
func (s) TestKeepaliveClientStaysHealthyWithResponsiveServer(t *testing.T) {
server, client, cancel := setUpWithOptions(t, 0, &ServerConfig{}, normal, ConnectOptions{
KeepaliveParams: keepalive.ClientParameters{
Time: 1 * time.Second,
Timeout: 1 * time.Second,
PermitWithoutStream: true,
}})
server, client, cancel := setUpWithOptions(t, 0,
&ServerConfig{
KeepalivePolicy: keepalive.EnforcementPolicy{
PermitWithoutStream: true,
},
},
normal,
ConnectOptions{
KeepaliveParams: keepalive.ClientParameters{
Time: 1 * time.Second,
Timeout: 1 * time.Second,
PermitWithoutStream: true,
}})
defer func() {
client.Close(fmt.Errorf("closed manually by test"))
server.stop()
Expand Down

0 comments on commit a16b156

Please sign in to comment.