mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
test: remove finite timeout in BlocksUntilSignaledAsync to fix race
Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/962b7404-4266-4a16-906c-ba3e607c2764 Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
fbccad091b
commit
69858b5a16
+6
-1
@@ -34,7 +34,12 @@ public sealed class InputWaiterTests : IDisposable
|
||||
[Fact]
|
||||
public async Task InputWaiter_WaitForInputAsync_BlocksUntilSignaledAsync()
|
||||
{
|
||||
Task waitTask = this._waiter.WaitForInputAsync(TimeSpan.FromSeconds(5));
|
||||
// Use the no-timeout overload: the wait must only be released by SignalInput.
|
||||
// Passing a finite timeout here is racy on slow hosts: if the test thread is
|
||||
// paused longer than the timeout (e.g., heavy CI load or GC) before the
|
||||
// assertion runs, SemaphoreSlim's internal timer fires and waitTask completes
|
||||
// on its own, causing the "should not complete before signaled" check to flake.
|
||||
Task waitTask = this._waiter.WaitForInputAsync(CancellationToken.None);
|
||||
|
||||
Task completedBeforeSignal = await Task.WhenAny(waitTask, Task.Delay(100));
|
||||
completedBeforeSignal.Should().NotBeSameAs(
|
||||
|
||||
Reference in New Issue
Block a user