Mark DSC Profile tests pending on MSIX test runs - #27884
Mark DSC Profile tests pending on MSIX test runs#27884Aditya Patwardhan (adityapatwardhan) wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR updates the DSC profile resource Pester tests to detect when they’re running under an MSIX-installed PowerShell (WindowsApps path) and avoid false failures by short-circuiting setup/cleanup and marking tests as Pending in that environment.
Changes:
- Added MSIX-context detection (
$PSHome -like '*WindowsApps*') in eachBeforeAlland early-exit behavior. - Added per-test MSIX guards intended to mark affected tests as Pending during MSIX runs.
- Updated cleanup blocks (
AfterAll) to no-op under MSIX context.
Suppressed comments (10)
test/powershell/dsc/dsc.profileresource.Tests.ps1:98
Set-ItResultin Pester uses-Because, not-Reason. Using-Reasonwill throw a parameter binding error and fail the test instead of marking it Pending.
Set-ItResult -Pending -Reason "Running in MSIX context. Skipping test."
test/powershell/dsc/dsc.profileresource.Tests.ps1:107
Set-ItResultin Pester uses-Because, not-Reason. Using-Reasonwill throw a parameter binding error and fail the test instead of marking it Pending.
Set-ItResult -Pending -Reason "Running in MSIX context. Skipping test."
test/powershell/dsc/dsc.profileresource.Tests.ps1:118
Set-ItResultin Pester uses-Because, not-Reason. Using-Reasonwill throw a parameter binding error and fail the test instead of marking it Pending.
Set-ItResult -Pending -Reason "Running in MSIX context. Skipping test."
test/powershell/dsc/dsc.profileresource.Tests.ps1:129
Set-ItResultin Pester uses-Because, not-Reason. Using-Reasonwill throw a parameter binding error and fail the test instead of marking it Pending.
Set-ItResult -Pending -Reason "Running in MSIX context. Skipping test."
test/powershell/dsc/dsc.profileresource.Tests.ps1:139
Set-ItResultin Pester uses-Because, not-Reason. Using-Reasonwill throw a parameter binding error and fail the test instead of marking it Pending.
Set-ItResult -Pending -Reason "Running in MSIX context. Skipping test."
test/powershell/dsc/dsc.profileresource.Tests.ps1:150
Set-ItResultin Pester uses-Because, not-Reason. Using-Reasonwill throw a parameter binding error and fail the test instead of marking it Pending.
Set-ItResult -Pending -Reason "Running in MSIX context. Skipping test."
test/powershell/dsc/dsc.profileresource.Tests.ps1:161
Set-ItResultin Pester uses-Because, not-Reason. Using-Reasonwill throw a parameter binding error and fail the test instead of marking it Pending.
Set-ItResult -Pending -Reason "Running in MSIX context. Skipping test."
test/powershell/dsc/dsc.profileresource.Tests.ps1:255
Set-ItResultin Pester uses-Because, not-Reason. Using-Reasonwill throw a parameter binding error and fail the test instead of marking it Pending.
Set-ItResult -Pending -Reason "Running in MSIX context. Skipping test."
test/powershell/dsc/dsc.profileresource.Tests.ps1:272
Set-ItResultin Pester uses-Because, not-Reason. Using-Reasonwill throw a parameter binding error and fail the test instead of marking it Pending.
Set-ItResult -Pending -Reason "Running in MSIX context. Skipping test."
test/powershell/dsc/dsc.profileresource.Tests.ps1:283
Set-ItResultin Pester uses-Because, not-Reason. Using-Reasonwill throw a parameter binding error and fail the test instead of marking it Pending.
Set-ItResult -Pending -Reason "Running in MSIX context. Skipping test."
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
PR Summary
This pull request updates the
dsc.profileresource.Tests.ps1test suite to improve compatibility with MSIX-packaged PowerShell environments. The main enhancement is the detection of the MSIX context, which results in tests being marked as pending and skipped when running in this environment. This prevents false failures due to known limitations of MSIX installations.Key changes:
MSIX Context Detection and Handling:
BeforeAll) to detect if the tests are running in an MSIX context by checking if$pshomecontainsWindowsApps. If so, a verbose message is logged and the tests are marked as pending or skipped. [1] [2]Set-ItResult -Pending. [1] [2] [3] [4]Test Flow Adjustments:
AfterAllandBeforeAllblocks also respect the MSIX context and exit early if detected. [1] [2]These changes make the test suite more robust and prevent unnecessary test failures when running under MSIX-packaged PowerShell.
PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header