Skip to content

Fix flaky keepalive ping test #24804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
2 commits merged into from
Aug 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ await ExpectAsync(Http2FrameType.PING,
}

[Fact]
[QuarantinedTest]
public async Task PING_NoKeepAliveTimeout_DoesNotResetKeepAliveTimeout()
{
var mockSystemClock = _serviceContext.MockSystemClock;
Expand All @@ -156,13 +157,14 @@ public async Task PING_NoKeepAliveTimeout_DoesNotResetKeepAliveTimeout()

CreateConnection();

await InitializeConnectionAsync(_noopApplication);
await InitializeConnectionAsync(_echoApplication);

// Connection starts and sets keep alive timeout
_mockTimeoutControl.Verify(c => c.SetTimeout(It.IsAny<long>(), TimeoutReason.KeepAlive), Times.Once);
_mockTimeoutControl.Verify(c => c.ResetTimeout(It.IsAny<long>(), TimeoutReason.KeepAlive), Times.Never);
_mockTimeoutControl.Verify(c => c.CancelTimeout(), Times.Never);

// Stream will stay open because it is waiting for request body to end
await StartStreamAsync(1, _browserRequestHeaders, endStream: false);

// Starting a stream cancels the keep alive timeout
Expand All @@ -176,6 +178,17 @@ await ExpectAsync(Http2FrameType.PING,

// Server doesn't reset keep alive timeout because it isn't running
_mockTimeoutControl.Verify(c => c.ResetTimeout(It.IsAny<long>(), TimeoutReason.KeepAlive), Times.Never);

// End stream
await SendDataAsync(1, _helloWorldBytes, endStream: true);
await ExpectAsync(Http2FrameType.HEADERS,
withLength: 32,
withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS,
withStreamId: 1);
await ExpectAsync(Http2FrameType.DATA,
withLength: _helloWorldBytes.Length,
withFlags: (byte)Http2DataFrameFlags.NONE,
withStreamId: 1);
}

[Fact]
Expand Down