(CAT-2824) code coverage increase - #387
Open
gregohardy wants to merge 14 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #387 +/- ##
==========================================
+ Coverage 90.99% 95.07% +4.08%
==========================================
Files 6 6
Lines 733 853 +120
==========================================
+ Hits 667 811 +144
+ Misses 66 42 -24 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
basic.rb and class.rb called Pwsh::Manager.instance at the top level of the file, causing RSpec to attempt a PowerShell pipe connection at load time on any platform. This produced a 30-second timeout followed by a hard error before any examples ran. Added if: Pwsh::Util.on_windows? to the top-level instantiation and RSpec.describe block in both files. Also increased the execute_reset_command timeout to 600s in complex.rb and added -NoRestart to Remove-WindowsFeature to prevent the reset step from hanging on slow CI Windows runners.
-NoRestart causes feature removal to be deferred until the next system reboot. On CI runners that never reboot between steps, Web-Asp-Net45 reported as still installed during the subsequent puppet run, so the dsc_xwindowsfeature[AspNet45] resource showed no change and the idempotency assertion failed. Remove the flag so the feature is fully uninstalled in the current session. The 600s timeout added in the previous commit is retained to handle the slow removal on CI Windows runners.
Ruby 4 no longer guarantees small integers are singleton objects, so the be matcher (which uses equal? / object identity) can fail even when the value matches. All exit code assertions across the acceptance specs are updated to use eq, which compares by value.
Reset-ProcessEnvironmentVariables restores all environment variables to their startup snapshot. If Install-Module adds entries to PSModulePath during a puppet run (e.g. installing a module to CurrentUser scope), those additions are wiped when the next execute call resets the env. The subsequent DSC Test then calls Get-Module -ListAvailable against a stale PSModulePath, cannot find the newly installed module, and reports drift — causing a second install and breaking idempotency. After restoring the cached env vars, rebuild PSModulePath by reading the current Machine and User values from the .NET Environment API. This reflects any modules permanently registered since process startup while still clearing transient process-level modifications.
This reverts commit 6b3ce0c.
The conditional .tr('/', '\\') if Pwsh::Util.on_windows? change was
unnecessary. PowerShell Core on Linux handles backslash paths correctly,
so the original unconditional conversion works on all platforms and
matches the vanilla behavior that acceptance tests depend on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Code coverage increased to > 90 %
Additional Context
NA
Related Issues (if any)
NA
Checklist