[release/v7.6] Fix $PSDefaultParameterValues leak causing tests to skip unexpectedly#26705
Merged
daxian-dbw merged 1 commit intoPowerShell:release/v7.6from Jan 21, 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 backports a test infrastructure fix from master (#26602) to the release/v7.6 branch. The fix addresses $PSDefaultParameterValues state leakage between test files that caused tests intended to run on Linux to be incorrectly skipped.
Changes:
- Fixed imbalanced
Push-DefaultParameterValueStack/Pop-DefaultParameterValueStackcalls in 2 test files - Replaced
.Remove()pattern with proper clone/restore pattern in 4 test files to ensure proper state isolation
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 tests are skipped |
| test/powershell/engine/Remoting/SessionOption.Tests.ps1 | Changed from .Remove() to clone/restore pattern for proper state isolation |
| test/powershell/engine/Remoting/RemoteSession.Basic.Tests.ps1 | Removed duplicate Pop-DefaultParameterValueStack call that had no matching Push |
| test/powershell/engine/ETS/CimAdapter.Tests.ps1 | Changed from .Remove() to clone/restore pattern for proper state isolation |
| test/powershell/Modules/Microsoft.PowerShell.Security/AclCmdlets.Tests.ps1 | Changed from .Remove() to clone/restore pattern for proper state isolation |
| test/powershell/Modules/Microsoft.PowerShell.Management/Rename-Computer.Tests.ps1 | Changed from .Remove() to clone/restore pattern for proper state isolation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jshigetomi
approved these changes
Jan 21, 2026
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.6
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
Customer Impact
Test infrastructure issue where $PSDefaultParameterValues leaks between test files caused tests that should run on Linux to be skipped. This only affects internal testing, not customer functionality.
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
The fix has been tested in the original PR. The changes restore proper state isolation in test files, ensuring that $PSDefaultParameterValues modifications don't leak to subsequent tests. This can be verified by running the affected test files on Linux and confirming that tests which should run on Linux are no longer skipped.
Risk
REQUIRED: Check exactly one box.
The changes only affect test isolation and don't modify any product code. The fixes ensure proper cleanup of test state, which cannot cause product regressions. The changes have already been tested and merged in master.