Skip to content

Commit 9950fd7

Browse files
authored
Fix race condition in flaky test (#1883)
1 parent 9852674 commit 9950fd7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: test/Grpc.Net.Client.Tests/Retry/HedgingCallTests.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ public async Task AsyncUnaryCall_CancellationDuringBackoff_CanceledStatus()
333333
var ex = await ExceptionAssert.ThrowsAsync<RpcException>(() => hedgingCall.GetResponseAsync()).DefaultTimeout();
334334
Assert.AreEqual(StatusCode.Cancelled, ex.StatusCode);
335335
Assert.AreEqual("Call canceled by the client.", ex.Status.Detail);
336-
Assert.IsNull(hedgingCall._ctsRegistration);
336+
337+
// There is a race between unregistering and GetResponseAsync returning.
338+
await TestHelpers.AssertIsTrueRetryAsync(() => hedgingCall._ctsRegistration == null, "Hedge call CTS unregistered.");
337339
}
338340

339341
[Test]

0 commit comments

Comments
 (0)