Skip to content

(CAT-2824) code coverage increase - #387

Open
gregohardy wants to merge 14 commits into
mainfrom
CAT-2824-pwsh
Open

(CAT-2824) code coverage increase#387
gregohardy wants to merge 14 commits into
mainfrom
CAT-2824-pwsh

Conversation

@gregohardy

Copy link
Copy Markdown
Contributor

Summary

Code coverage increased to > 90 %

Additional Context

NA

Related Issues (if any)

NA

Checklist

  • [ x] 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified.

@gregohardy
gregohardy requested a review from a team as a code owner September 3, 2026 16:45
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.07%. Comparing base (d7cee48) to head (81d38c0).
⚠️ Report is 18 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

gregohardy and others added 11 commits September 4, 2026 13:49
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant