[release/v7.5] Fix $PSDefaultParameterValues leak causing tests to skip unexpectedly#26823
Merged
daxian-dbw merged 1 commit intoPowerShell:release/v7.5from Feb 14, 2026
Conversation
…PowerShell#26602) This fixes test isolation issues where six test files were leaking $PSDefaultParameterValues["It:Skip"] settings to subsequent tests, causing widespread test skipping on Linux. The fixes address two distinct patterns: using .Remove() which doesn't restore the original state (4 files), and imbalanced Push-DefaultParameterValueStack/Pop-DefaultParameterValueStack calls (2 files).
Contributor
There was a problem hiding this comment.
Pull request overview
This PR is a backport of #26602 to the release/v7.5 branch, fixing $PSDefaultParameterValues leaks in six test files that were causing tests to skip unexpectedly on Linux. The leaks occurred when test files modified $PSDefaultParameterValues["It:Skip"] but failed to properly restore the original state, causing the modification to persist and affect subsequent tests.
Changes:
- Fixed 4 test files that used
.Remove()by switching to the Clone/restore pattern - Fixed 2 test files with imbalanced Push-DefaultParameterValueStack/Pop-DefaultParameterValueStack calls
- All changes ensure proper test isolation by restoring $PSDefaultParameterValues to its original state
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/powershell/engine/Security/FileSignature.Tests.ps1 | Added missing Pop-DefaultParameterValueStack call in AfterAll when shouldSkip is true |
| test/powershell/engine/Remoting/SessionOption.Tests.ps1 | Replaced .Remove() with Clone/restore pattern to properly isolate $PSDefaultParameterValues changes |
| test/powershell/engine/Remoting/RemoteSession.Basic.Tests.ps1 | Removed unconditional Pop that had no matching Push, fixing imbalanced Push/Pop calls |
| test/powershell/engine/ETS/CimAdapter.Tests.ps1 | Replaced .Remove() with Clone/restore pattern and fixed typo (it:pending vs It:Skip) |
| test/powershell/Modules/Microsoft.PowerShell.Security/AclCmdlets.Tests.ps1 | Replaced .Remove() with Clone/restore pattern to properly isolate $PSDefaultParameterValues changes |
| test/powershell/Modules/Microsoft.PowerShell.Management/Rename-Computer.Tests.ps1 | Replaced .Remove() with Clone/restore pattern to properly isolate $PSDefaultParameterValues changes |
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.
Backport of #26602 to release/v7.5
Triggered by @daxian-dbw on behalf of @app/copilot-swe-agent
Original CL Label: CL-Test
/cc @PowerShell/powershell-maintainers
Impact
REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.
Tooling Impact
Fixes $PSDefaultParameterValues leaks in test files causing unexpected test skipping
Customer Impact
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
Fixes issue #26601. Tests now properly isolate $PSDefaultParameterValues changes. Validated in 7.6 release.
Risk
REQUIRED: Check exactly one box.
Fixes test infrastructure issue where tests were incorrectly skipped on Linux. Changes only affect test files. Successfully backported to 7.6 branch.