test: harden retry and circuit-breaker generator coverage#472
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
Adds additional TinyBDD scenarios to improve source-generator test coverage for the RetryPolicy and CircuitBreakerPolicy generators, specifically targeting host type-shape variants (abstract/sealed) and nested accessibility combinations to help close coverage gaps (Refs #413).
Changes:
- Added generator scenarios verifying emission for abstract and sealed retry-policy hosts.
- Added generator scenarios verifying emission for abstract and sealed circuit-breaker-policy hosts.
- Added scenarios covering nested host accessibility variants for both generators.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/PatternKit.Generators.Tests/RetryPolicyGeneratorTests.cs | Adds new scenarios for abstract/sealed hosts and nested accessibility variants for RetryPolicy generation. |
| test/PatternKit.Generators.Tests/CircuitBreakerPolicyGeneratorTests.cs | Adds new scenarios for abstract/sealed hosts and nested accessibility variants for CircuitBreakerPolicy generation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var comp = CreateCompilation(source, nameof(GeneratesRetryPolicySourceForNestedAccessibilityVariants)); | ||
| var gen = new RetryPolicyGenerator(); | ||
| _ = RoslynTestHelpers.Run(comp, gen, out var run, out _); | ||
|
|
||
| ScenarioExpect.All(run.Results, result => ScenarioExpect.Empty(result.Diagnostics)); | ||
| var generatedText = string.Join("\n", run.Results.SelectMany(result => result.GeneratedSources).Select(source => source.SourceText.ToString())); | ||
| ScenarioExpect.Contains("private partial class PrivateRetryHost", generatedText); | ||
| ScenarioExpect.Contains("protected partial class ProtectedRetryHost", generatedText); | ||
| ScenarioExpect.Contains("protected internal partial class ProtectedInternalRetryHost", generatedText); | ||
| ScenarioExpect.Contains("private protected partial class PrivateProtectedRetryHost", generatedText); | ||
| } |
| var comp = CreateCompilation(source, nameof(GeneratesCircuitBreakerPolicySourceForNestedAccessibilityVariants)); | ||
| var gen = new CircuitBreakerPolicyGenerator(); | ||
| _ = RoslynTestHelpers.Run(comp, gen, out var run, out _); | ||
|
|
||
| ScenarioExpect.All(run.Results, result => ScenarioExpect.Empty(result.Diagnostics)); | ||
| var generatedText = string.Join("\n", run.Results.SelectMany(result => result.GeneratedSources).Select(source => source.SourceText.ToString())); | ||
| ScenarioExpect.Contains("private partial class PrivateCircuitBreakerHost", generatedText); | ||
| ScenarioExpect.Contains("protected partial class ProtectedCircuitBreakerHost", generatedText); | ||
| ScenarioExpect.Contains("protected internal partial class ProtectedInternalCircuitBreakerHost", generatedText); | ||
| ScenarioExpect.Contains("private protected partial class PrivateProtectedCircuitBreakerHost", generatedText); | ||
| } |
Test Results 12 files 12 suites 11m 22s ⏱️ Results for commit d6751cd. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #472 +/- ##
==========================================
+ Coverage 97.12% 97.27% +0.14%
==========================================
Files 579 579
Lines 47180 47180
Branches 3083 6768 +3685
==========================================
+ Hits 45823 45893 +70
+ Misses 1357 1287 -70
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Coverage |
🔍 PR Validation ResultsVersion: `` ✅ Validation Steps
📊 ArtifactsDry-run artifacts have been uploaded and will be available for 7 days. This comment was automatically generated by the PR validation workflow. |
Summary
Refs #413
Verification
RetryPolicyGeneratorTests|FullyQualifiedNameCircuitBreakerPolicyGeneratorTests"