Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions test/Polly.Core.Tests/Hedging/HedgingStrategyOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public async Task HedgingActionGenerator_EnsureDefaults(bool synchronous)
var options = new HedgingStrategyOptions<int>();
var context = ResilienceContextPool.Shared.Get().Initialize<int>(synchronous);
var threadId = Thread.CurrentThread.ManagedThreadId;
using var semaphore = new SemaphoreSlim(0);

var action = options.ActionGenerator(new HedgingActionGeneratorArguments<int>(context, context, 1, c =>
{
Expand All @@ -39,11 +40,16 @@ public async Task HedgingActionGenerator_EnsureDefaults(bool synchronous)
Thread.CurrentThread.ManagedThreadId.Should().Be(threadId);
}

semaphore.Release();
return Outcome.FromResultAsValueTask(99);
}))!;

action.Should().NotBeNull();
(await action()).Result.Should().Be(99);
var task = action();
semaphore
.Wait(TimeSpan.FromSeconds(20))
.Should()
.BeTrue($"The test thread failed to enter the {nameof(semaphore)}, the hedging callback didn't executed");
(await task).Result.Should().Be(99);
}

[Fact]
Expand Down
5 changes: 0 additions & 5 deletions test/Polly.Core.Tests/Polly.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,4 @@
<Using Include="Polly.Core.Tests.Helpers" />
<Using Include="Polly.TestUtils" />
</ItemGroup>

<!-- Workaround for xunit 2.8.0+ change. See https://github.com/xunit/xunit/discussions/3024. -->
<ItemGroup>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>
4 changes: 0 additions & 4 deletions test/Polly.Core.Tests/xunit.runner.json

This file was deleted.