Skip to content

Commit

Permalink
Fix #2288 (#2313)
Browse files Browse the repository at this point in the history
Remove xunit workaround.
  • Loading branch information
gabidabet authored Sep 28, 2024
1 parent 22d09c0 commit 9f004a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
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 complete within the timeout");
(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.

0 comments on commit 9f004a2

Please sign in to comment.