From bbaba10171c0e8d26b9d31877799d2ebe309c7ee Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 10:15:34 -0700 Subject: [PATCH] [release/8.0] Add Retry and Task.Delay to WinHttpHandler AfterReadResponseServerError_ClientWrite test (#91271) * Add Task.Delay to give more time for reset frame * Apply James' solution --------- Co-authored-by: Ahmet Ibrahim Aksoy (from Dev Box) --- .../FunctionalTests/BidirectionStreamingTest.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/BidirectionStreamingTest.cs b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/BidirectionStreamingTest.cs index d18de54bc46..ce79f20ad4e 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/BidirectionStreamingTest.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/BidirectionStreamingTest.cs @@ -143,7 +143,17 @@ public async Task AfterReadResponseServerError_ClientWrite() // Server sends RST_STREAM. await connection.WriteFrameAsync(new RstStreamFrame(FrameFlags.EndStream, 0, streamId)); - await Assert.ThrowsAsync(() => requestStream.WriteAsync(new byte[50]).AsTask()); + await Assert.ThrowsAsync(async () => + { + for (int i = 0; i < 10; i++) + { + await requestStream.WriteAsync(new byte[50]); + + // WriteAsync succeeded because handler hasn't processed RST_STREAM yet. + // Small wait before trying again. + await Task.Delay(50); + } + }); } } -- GitLab