mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-08-19 12:32:34 -04:00
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
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user