Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions test/Polly.Specs/Bulkhead/BulkheadSpecsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
[Collection(Constants.ParallelThreadDependentTestCollection)]
public abstract class BulkheadSpecsBase : IDisposable
{
protected static AssertionFailure? Expect(int expected, Func<int> actualFunc, string measure)
{
int actual = actualFunc();
return actual != expected ? new AssertionFailure(expected, actual, measure) : null;
}

#region Time constraints

protected readonly TimeSpan ShimTimeSpan = TimeSpan.FromMilliseconds(50); // How frequently to retry the assertions.
Expand Down Expand Up @@ -312,12 +318,6 @@ protected void EnsureNoUnbservedTaskExceptions()

#endregion

protected static AssertionFailure? Expect(int expected, Func<int> actualFunc, string measure)
{
int actual = actualFunc();
return actual != expected ? new AssertionFailure(expected, actual, measure) : null;
}

protected void Within(TimeSpan timeSpan, Func<AssertionFailure?> actionContainingAssertions)
{
TimeSpan permitted = timeSpan;
Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/Polly.Specs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<Include>[Polly]*</Include>
<IncludePollyUsings>true</IncludePollyUsings>
<NoWarn>$(NoWarn);CA1030;CA1031;CA2008;CA2201</NoWarn>
<NoWarn>$(NoWarn);S104;S2184;S6966</NoWarn>
<NoWarn>$(NoWarn);SA1204;SA1402;SA1600</NoWarn>
<NoWarn>$(NoWarn);S104;S6966</NoWarn>
<NoWarn>$(NoWarn);SA1402;SA1600</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/Polly.Specs/Retry/WaitAndRetryAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ public async Task Should_honour_cancellation_immediately_during_wait_phase_of_wa
attemptsInvoked.Should().Be(1);

watch.Elapsed.Should().BeLessThan(retryDelay);
watch.Elapsed.Should().BeCloseTo(shimTimeSpan, precision: TimeSpan.FromMilliseconds((int)shimTimeSpan.TotalMilliseconds / 2)); // Consider increasing shimTimeSpan, or loosening precision, if test fails transiently in different environments.
watch.Elapsed.Should().BeCloseTo(shimTimeSpan, precision: TimeSpan.FromMilliseconds(shimTimeSpan.TotalMilliseconds / 2)); // Consider increasing shimTimeSpan, or loosening precision, if test fails transiently in different environments.
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion test/Polly.Specs/Retry/WaitAndRetrySpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ public void Should_honour_cancellation_immediately_during_wait_phase_of_waitandr
attemptsInvoked.Should().Be(1);

watch.Elapsed.Should().BeLessThan(retryDelay);
watch.Elapsed.Should().BeCloseTo(shimTimeSpan, precision: TimeSpan.FromMilliseconds((int)shimTimeSpan.TotalMilliseconds / 2)); // Consider increasing shimTimeSpan, or loosening precision, if test fails transiently in different environments.
watch.Elapsed.Should().BeCloseTo(shimTimeSpan, precision: TimeSpan.FromMilliseconds(shimTimeSpan.TotalMilliseconds / 2)); // Consider increasing shimTimeSpan, or loosening precision, if test fails transiently in different environments.
}

[Fact]
Expand Down