test: stabilize single-flight concurrency fixtures
CI / build-and-test (push) Canceled after 0s
CI / state-transfer-tests (push) Canceled after 0s
CI / csharp-format (push) Canceled after 0s
CI / webui (push) Canceled after 0s
CI / release-manifest (push) Canceled after 0s
CI / apple-contracts (push) Canceled after 0s
CI / compose-contracts (push) Canceled after 0s

This commit is contained in:
2026-07-31 02:00:57 -04:00
parent 1b9206e907
commit e0d4cef815
2 changed files with 12 additions and 6 deletions
@@ -802,7 +802,7 @@ public sealed class PlaylistOrchestrationIntegrationTests(ITestOutputHelper outp
It.IsAny<ProtocolExecutionContext>(), "Concurrent external", 60))
.Returns(async () =>
{
if (Interlocked.Increment(ref entered) == 8)
if (Interlocked.Increment(ref entered) == snapshotIds.Length)
release.SetResult();
await release.Task;
return
@@ -52,19 +52,25 @@ public sealed class MultiProviderMetadataServiceTests
[Fact]
public async Task Provider_deadline_is_linked_to_the_underlying_operation()
{
var cancelled = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
var cancellationObserved = false;
await Assert.ThrowsAsync<TimeoutException>(() =>
MultiProviderMetadataService.RunTimedAsync(
async token =>
{
using var registration = token.Register(cancelled.SetResult);
await Task.Delay(Timeout.InfiniteTimeSpan, token);
return 1;
try
{
await Task.Delay(Timeout.InfiniteTimeSpan, token);
return 1;
}
finally
{
cancellationObserved = token.IsCancellationRequested;
}
},
TimeSpan.FromMilliseconds(25),
CancellationToken.None));
await cancelled.Task.WaitAsync(TimeSpan.FromSeconds(5));
Assert.True(cancellationObserved);
}
}