internal: fix flaky test KeepaliveClientStaysHealthyWithResponsiveServer (#4427)

Server should allow `NoStream`, otherwise there's a small chance
(5/1000) the connection will be closed due to `too many pings`.
This commit is contained in:
Menghan Li 2021-05-12 17:43:29 -07:00 коммит произвёл GitHub
Родитель 6fea90d7a8
Коммит a16b156e99
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 13 добавлений и 6 удалений

Просмотреть файл

@ -346,12 +346,19 @@ func (s) TestKeepaliveClientClosesWithActiveStreams(t *testing.T) {
// responds to keepalive pings, and makes sure than a client transport stays // responds to keepalive pings, and makes sure than a client transport stays
// healthy without any active streams. // healthy without any active streams.
func (s) TestKeepaliveClientStaysHealthyWithResponsiveServer(t *testing.T) { func (s) TestKeepaliveClientStaysHealthyWithResponsiveServer(t *testing.T) {
server, client, cancel := setUpWithOptions(t, 0, &ServerConfig{}, normal, ConnectOptions{ server, client, cancel := setUpWithOptions(t, 0,
KeepaliveParams: keepalive.ClientParameters{ &ServerConfig{
Time: 1 * time.Second, KeepalivePolicy: keepalive.EnforcementPolicy{
Timeout: 1 * time.Second, PermitWithoutStream: true,
PermitWithoutStream: true, },
}}) },
normal,
ConnectOptions{
KeepaliveParams: keepalive.ClientParameters{
Time: 1 * time.Second,
Timeout: 1 * time.Second,
PermitWithoutStream: true,
}})
defer func() { defer func() {
client.Close(fmt.Errorf("closed manually by test")) client.Close(fmt.Errorf("closed manually by test"))
server.stop() server.stop()