This is an automated email from the ASF dual-hosted git repository.
CurtHagenlocher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-dotnet.git
The following commit(s) were added to refs/heads/main by this push:
new a9ae066 test: Make EnsureCallRaisesRequestCancelled deterministic
(#467)
a9ae066 is described below
commit a9ae066da3d296d02425f8041f2d502b42f1fe50
Author: Curt Hagenlocher <[email protected]>
AuthorDate: Sun Oct 18 09:37:24 2026 -0700
test: Make EnsureCallRaisesRequestCancelled deterministic (#467)
## What's Changed
`FlightTests.EnsureCallRaisesRequestCancelled` cancelled its token with
`CancelAfter(1)` and then awaited `Task.Delay(5)`, assuming the 1 ms
cancellation would fire before the 5 ms delay completed. Nothing
guarantees that ordering. On a loaded runner the first `ListFlights`
call can start and complete before the token is cancelled, and the test
fails with "Assert.Throws() Failure: No exception was thrown". This
happened on macOS in the Verify job for #465, where the same test had
passed earlier in the same job.
The test now cancels the token before making any calls, so every call
sees an already-cancelled token. What the test checks is unchanged: each
client call surfaces `StatusCode.Cancelled`.
Locally the test passed 25 of 25 runs, and the full Flight test suite
passes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
test/Apache.Arrow.Flight.Tests/FlightTests.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/Apache.Arrow.Flight.Tests/FlightTests.cs
b/test/Apache.Arrow.Flight.Tests/FlightTests.cs
index 46662cc..47d621a 100644
--- a/test/Apache.Arrow.Flight.Tests/FlightTests.cs
+++ b/test/Apache.Arrow.Flight.Tests/FlightTests.cs
@@ -513,12 +513,12 @@ namespace Apache.Arrow.Flight.Tests
[Fact]
public async Task EnsureCallRaisesRequestCancelled()
{
+ // Cancel up front rather than racing a timer, so every call sees
a cancelled token
var cts = new CancellationTokenSource();
- cts.CancelAfter(1);
+ cts.Cancel();
var batch = CreateTestBatch(0, 100);
var flightDescriptor =
FlightDescriptor.CreatePathDescriptor("raise_cancelled");
- await Task.Delay(5);
RpcException exception = null;
var asyncServerStreamingCallFlights =
_flightClient.ListFlights(null, null, null, cts.Token);