Add specification tests for jitter#2830
Conversation
Add some specification tests for the application of jitter in retries using FsCheck.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
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
ApplyJitterandDecorrelatedJitterBackoffV2behavior - 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.
Apply recommendations/fixes suggested by Copilot in #2830.
Apply recommendations/fixes suggested by Copilot in #2830.
Updated [Polly.Core](https://github.com/App-vNext/Polly) from 8.6.5 to 8.6.6. <details> <summary>Release notes</summary> _Sourced from [Polly.Core's releases](https://github.com/App-vNext/Polly/releases)._ ## 8.6.6 ## Highlights * Fix `ScheduledTaskExecutor` deadlock when `TrySetResult` runs continuations inline by @crnhrv in App-vNext/Polly#2953 ## What's Changed * Add specification tests for jitter by @martincostello in App-vNext/Polly#2830 * Refactor property-based tests by @martincostello in App-vNext/Polly#2831 * .NET 10 preparation by @martincostello in App-vNext/Polly#2842 * Fix CS7035 warning in dependabot jobs by @martincostello in App-vNext/Polly#2849 * Remove codecov/test-results-action by @martincostello in App-vNext/Polly#2872 * Update to .NET 10 SDK by @martincostello in App-vNext/Polly#2531 * Bump zizmor to v1.19.0 by @martincostello in App-vNext/Polly#2882 * Fix typo by @martincostello in App-vNext/Polly#2886 * Add RateLimitHeaders library to community resources by @alexis- in App-vNext/Polly#2887 * Bump zizmor to 1.21.0 by @martincostello in App-vNext/Polly#2905 * .NET 11 preparation by @martincostello in App-vNext/Polly#2932 * Remove Stryker workaround by @martincostello in App-vNext/Polly#2933 * Group .NET dependency updates by @martincostello in App-vNext/Polly#2944 * Migrate to actions/attest by @martincostello in App-vNext/Polly#2952 ## New Contributors * @alexis- made their first contribution in App-vNext/Polly#2887 * @crnhrv made their first contribution in App-vNext/Polly#2953 **Full Changelog**: App-vNext/Polly@8.6.5...8.6.6 Commits viewable in [compare view](App-vNext/Polly@8.6.5...8.6.6). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: James Gunn <james@gunn.io>
Updated [Polly](https://github.com/App-vNext/Polly) from 8.6.5 to 8.6.6. <details> <summary>Release notes</summary> _Sourced from [Polly's releases](https://github.com/App-vNext/Polly/releases)._ ## 8.6.6 ## Highlights * Fix `ScheduledTaskExecutor` deadlock when `TrySetResult` runs continuations inline by @crnhrv in App-vNext/Polly#2953 ## What's Changed * Add specification tests for jitter by @martincostello in App-vNext/Polly#2830 * Refactor property-based tests by @martincostello in App-vNext/Polly#2831 * .NET 10 preparation by @martincostello in App-vNext/Polly#2842 * Fix CS7035 warning in dependabot jobs by @martincostello in App-vNext/Polly#2849 * Remove codecov/test-results-action by @martincostello in App-vNext/Polly#2872 * Update to .NET 10 SDK by @martincostello in App-vNext/Polly#2531 * Bump zizmor to v1.19.0 by @martincostello in App-vNext/Polly#2882 * Fix typo by @martincostello in App-vNext/Polly#2886 * Add RateLimitHeaders library to community resources by @alexis- in App-vNext/Polly#2887 * Bump zizmor to 1.21.0 by @martincostello in App-vNext/Polly#2905 * .NET 11 preparation by @martincostello in App-vNext/Polly#2932 * Remove Stryker workaround by @martincostello in App-vNext/Polly#2933 * Group .NET dependency updates by @martincostello in App-vNext/Polly#2944 * Migrate to actions/attest by @martincostello in App-vNext/Polly#2952 ## New Contributors * @alexis- made their first contribution in App-vNext/Polly#2887 * @crnhrv made their first contribution in App-vNext/Polly#2953 **Full Changelog**: App-vNext/Polly@8.6.5...8.6.6 Commits viewable in [compare view](App-vNext/Polly@8.6.5...8.6.6). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Add some specification tests for the application of jitter in retries using FsCheck.