Remove flaky FlowControl_ParallelStreams_FirstInFirstOutOrder… (#21037)
This commit is contained in:
parent
66d7226072
commit
42056d27d2
|
|
@ -60,141 +60,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
|||
await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[QuarantinedTest]
|
||||
public async Task FlowControl_ParallelStreams_FirstInFirstOutOrder()
|
||||
{
|
||||
// The test will:
|
||||
// 1. Create a stream with a large response. It will use up the connection window and complete.
|
||||
// 2. Create two streams will smaller responses.
|
||||
// 3. Update the connection window one byte at a time.
|
||||
// 4. Read from them in a FIFO order until they are each complete.
|
||||
|
||||
// Ensure there that all backpressure is due to connection flow control, not the pipe.
|
||||
_serviceContext.ServerOptions.Limits.MaxResponseBufferSize = long.MaxValue;
|
||||
// Ensure there that all backpressure is due to connection flow control, not stream flow control.
|
||||
_clientSettings.InitialWindowSize = int.MaxValue;
|
||||
|
||||
await InitializeConnectionAsync(c =>
|
||||
{
|
||||
var responseBodySize = Convert.ToInt32(c.Request.Headers["ResponseBodySize"]);
|
||||
return c.Response.Body.WriteAsync(new byte[responseBodySize]).AsTask();
|
||||
});
|
||||
|
||||
// Consume the entire connection output flow control window with a large response.
|
||||
await StartStreamAsync(1, GetHeaders(responseBodySize: 65535), endStream: true);
|
||||
|
||||
await ExpectAsync(Http2FrameType.HEADERS,
|
||||
withLength: 32,
|
||||
withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS,
|
||||
withStreamId: 1);
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 16384,
|
||||
withFlags: (byte)Http2DataFrameFlags.NONE,
|
||||
withStreamId: 1);
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 16384,
|
||||
withFlags: (byte)Http2DataFrameFlags.NONE,
|
||||
withStreamId: 1);
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 16384,
|
||||
withFlags: (byte)Http2DataFrameFlags.NONE,
|
||||
withStreamId: 1);
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 16383,
|
||||
withFlags: (byte)Http2DataFrameFlags.NONE,
|
||||
withStreamId: 1);
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 0,
|
||||
withFlags: (byte)Http2DataFrameFlags.END_STREAM,
|
||||
withStreamId: 1);
|
||||
|
||||
await StartStreamAsync(3, GetHeaders(responseBodySize: 3), endStream: true);
|
||||
|
||||
await ExpectAsync(Http2FrameType.HEADERS,
|
||||
withLength: 2,
|
||||
withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS,
|
||||
withStreamId: 3);
|
||||
|
||||
await StartStreamAsync(5, GetHeaders(responseBodySize: 3), endStream: true);
|
||||
|
||||
await ExpectAsync(Http2FrameType.HEADERS,
|
||||
withLength: 2,
|
||||
withFlags: (byte)Http2HeadersFrameFlags.END_HEADERS,
|
||||
withStreamId: 5);
|
||||
|
||||
await SendWindowUpdateAsync(streamId: 0, 1);
|
||||
|
||||
// FIFO means stream 3 returns data first
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 1,
|
||||
withFlags: (byte)Http2DataFrameFlags.NONE,
|
||||
withStreamId: 3);
|
||||
|
||||
await SendWindowUpdateAsync(streamId: 0, 1);
|
||||
|
||||
// Stream 5 data
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 1,
|
||||
withFlags: (byte)Http2DataFrameFlags.NONE,
|
||||
withStreamId: 5);
|
||||
|
||||
await SendWindowUpdateAsync(streamId: 0, 1);
|
||||
|
||||
// Stream 3 data
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 1,
|
||||
withFlags: (byte)Http2DataFrameFlags.NONE,
|
||||
withStreamId: 3);
|
||||
|
||||
await SendWindowUpdateAsync(streamId: 0, 1);
|
||||
|
||||
// Stream 5 data
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 1,
|
||||
withFlags: (byte)Http2DataFrameFlags.NONE,
|
||||
withStreamId: 5);
|
||||
|
||||
await SendWindowUpdateAsync(streamId: 0, 1);
|
||||
|
||||
// Stream 3 data
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 1,
|
||||
withFlags: (byte)Http2DataFrameFlags.NONE,
|
||||
withStreamId: 3);
|
||||
|
||||
// Stream 3 ends
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 0,
|
||||
withFlags: (byte)Http2DataFrameFlags.END_STREAM,
|
||||
withStreamId: 3);
|
||||
|
||||
await SendWindowUpdateAsync(streamId: 0, 1);
|
||||
|
||||
// Stream 5 data
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 1,
|
||||
withFlags: (byte)Http2DataFrameFlags.NONE,
|
||||
withStreamId: 5);
|
||||
|
||||
await ExpectAsync(Http2FrameType.DATA,
|
||||
withLength: 0,
|
||||
withFlags: (byte)Http2DataFrameFlags.END_STREAM,
|
||||
withStreamId: 5);
|
||||
|
||||
await StopConnectionAsync(expectedLastStreamId: 5, ignoreNonGoAwayFrames: false);
|
||||
|
||||
IEnumerable<KeyValuePair<string, string>> GetHeaders(int responseBodySize)
|
||||
{
|
||||
foreach (var header in _browserRequestHeaders)
|
||||
{
|
||||
yield return header;
|
||||
}
|
||||
|
||||
yield return new KeyValuePair<string, string>("ResponseBodySize", responseBodySize.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task FlowControl_OneStream_CorrectlyAwaited()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue