Skip to content

Add specification tests for jitter#2830

Merged
martincostello merged 1 commit into
mainfrom
add-specification-tests
Nov 24, 2025
Merged

Add specification tests for jitter#2830
martincostello merged 1 commit into
mainfrom
add-specification-tests

Conversation

@martincostello
Copy link
Copy Markdown
Member

Add some specification tests for the application of jitter in retries using FsCheck.

Add some specification tests for the application of jitter in retries using FsCheck.
@martincostello martincostello added enhancement dependencies Pull requests that update a dependency file .NET Pull requests that update .NET code labels Nov 24, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.15%. Comparing base (c707b24) to head (f5c2868).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2830   +/-   ##
=======================================
  Coverage   96.15%   96.15%           
=======================================
  Files         309      309           
  Lines        7123     7123           
  Branches     1005     1005           
=======================================
  Hits         6849     6849           
  Misses        221      221           
  Partials       53       53           
Flag Coverage Δ
linux 96.15% <100.00%> (ø)
macos 96.15% <100.00%> (ø)
windows 96.14% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@martincostello martincostello marked this pull request as ready for review November 24, 2025 16:01
Copilot AI review requested due to automatic review settings November 24, 2025 16:01
@martincostello martincostello merged commit 156a9bb into main Nov 24, 2025
36 of 37 checks passed
@martincostello martincostello deleted the add-specification-tests branch November 24, 2025 16:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds property-based specification tests for retry jitter functionality using the FsCheck framework. The changes enable comprehensive testing of jitter algorithms by generating and validating thousands of random test cases.

Key changes:

  • Added two FsCheck property-based tests to verify ApplyJitter and DecorrelatedJitterBackoffV2 behavior
  • Made two retry helper methods internal to enable direct testing
  • Added FsCheck.Xunit package dependency (version 3.3.2)

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
test/Polly.Core.Tests/Retry/RetryHelperTests.cs Added property-based tests with custom arbitraries for generating test data, and changed helper method visibility
src/Polly.Core/Retry/RetryHelper.cs Changed two methods from private to internal to enable testing, and reorganized code (moved methods)
test/Polly.Core.Tests/Polly.Core.Tests.csproj Added FsCheck.Xunit package reference for property-based testing
Directory.Packages.props Added FsCheck.Xunit version specification (3.3.2)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/Polly.Core.Tests/Retry/RetryHelperTests.cs
Comment thread test/Polly.Core.Tests/Retry/RetryHelperTests.cs
Comment thread test/Polly.Core.Tests/Retry/RetryHelperTests.cs
Comment thread test/Polly.Core.Tests/Retry/RetryHelperTests.cs
Comment thread src/Polly.Core/Retry/RetryHelper.cs
Comment thread test/Polly.Core.Tests/Retry/RetryHelperTests.cs
Comment thread test/Polly.Core.Tests/Retry/RetryHelperTests.cs
martincostello added a commit that referenced this pull request Nov 24, 2025
Apply recommendations/fixes suggested by Copilot in #2830.
martincostello added a commit that referenced this pull request Nov 24, 2025
Apply recommendations/fixes suggested by Copilot in #2830.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement .NET Pull requests that update .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants