Skip to content

Commit 748dd8e

Browse files
authored
make Http2_RequestFailsWithAppropriateHttpProtocolException test more deterministic (#94112)
* make Http2_IncorrectServerPreface_RequestFailsWithAppropriateHttpProtocolException test more deterministic * feedback
1 parent d5435e4 commit 748dd8e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ public async Task Http2_StreamResetByServerBeforePrefix_RequestFailsWithGoawayPr
139139

140140
Http2LoopbackConnection connection = await server.AcceptConnectionAsync(timeout: null);
141141
_ = await connection.ReadSettingsAsync();
142-
142+
// Wait until client starts sending request
143+
_ = await connection.ReadFrameAsync(TestHelper.PassingTestTimeout);
143144
GoAwayFrame goAwayFrame = new GoAwayFrame(lastStreamId: 0, (int)ProtocolErrors.HTTP_1_1_REQUIRED, additionalDebugData: Array.Empty<byte>(), streamId: 0);
144145
await connection.WriteFrameAsync(goAwayFrame);
145146

@@ -319,6 +320,8 @@ public async Task Http2_IncorrectServerPreface_RequestFailsWithAppropriateHttpPr
319320

320321
Http2LoopbackConnection connection = await server.AcceptConnectionAsync();
321322
await connection.ReadSettingsAsync();
323+
// Wait until client starts sending request
324+
_ = await connection.ReadFrameAsync(TestHelper.PassingTestTimeout);
322325
await connection.SendGoAway(0, ProtocolErrors.INTERNAL_ERROR);
323326

324327
await AssertProtocolErrorAsync(sendTask, ProtocolErrors.INTERNAL_ERROR);

0 commit comments

Comments
 (0)