Skip to content

Quote wildcard filters passed to dsc in argument tests - #1784

Merged
Steve Lee (SteveL-MSFT) merged 1 commit into
PowerShell:mainfrom
ChrisTX:fix-adapter-filter-test-quoting
Nov 2, 2026
Merged

Steve Lee (SteveL-MSFT) merged 1 commit into
PowerShell:mainfrom
ChrisTX:fix-adapter-filter-test-quoting

Conversation

@ChrisTX

Copy link
Copy Markdown
Contributor

PR Summary

On Linux and macOS, PowerShell expands wildcards in unquoted arguments of native commands, matching file names in the current directory without regard to case. The test verify `dsc resource list * adapter_filter` in dsc/tests/config/dsc_args.tests.ps1 runs

dsc resource list '*' -a Test* -o json

When the tests run from the repository root, Test* matches the tests folder, so dsc gets -a tests and fails:

error: invalid value 'tests' for '--adapter <ADAPTER_NAME>': invalid literal type name filter: invalid fully qualified type name 'tests': missing required name segment following forward slash (`/`) character

The test still passes. It only checks the resources that come back, and none do.

This PR:

  • quotes the wildcard filters in dsc_args.tests.ps1, as the test above it already does with '*'
  • checks the exit code in the adapter filter test, and that it finds at least one resource. With the quoted filter, it finds the four resources of Test/Adapter and Test/TestGroup.

The test on line 169 only runs on Windows, where PowerShell doesn't expand the arguments. I quoted it as well so that the file is consistent.

PR Context

With the filter unquoted, the new checks fail on Linux (Expected 0, but got 2). With it quoted, both adapter filter tests pass.

🤖 Generated with Claude Code

Outside Windows, PowerShell expands wildcards in unquoted arguments of
native commands against the current directory. When the tests run from
the repository root, `-a Test*` became `-a tests`, which dsc rejects, and
the adapter filter test passed without checking any resource. Quote the
filters and check that the test finds resources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 2, 2026 01:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the DSC argument-test changes.

No open issues 🎉

What changed in this PR

This PR makes DSC argument tests more reliable by preventing PowerShell wildcard expansion on Linux and macOS and detecting adapter-listing failures.

Changes:

  • Quotes wildcard resource and adapter filters, including the Windows-only tracing test.
  • Adds exit-code and nonempty-result assertions so the adapter filter test cannot pass without returning resources.
File Description
dsc/​tests/​config/​dsc_args.tests.ps1 Quotes wildcard filters and strengthens adapter filter assertions.

Review effort: Balanced

Christian Pfeiffer (ChrisTX) added a commit to ChrisTX/aur-packages that referenced this pull request Nov 2, 2026
- The quoted adapter filter is PowerShell/DSC#1784 upstream

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Arch Linux Technical User (archlinux-github) pushed a commit to archlinux/aur that referenced this pull request Nov 2, 2026
- The quoted adapter filter is PowerShell/DSC#1784 upstream

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SteveL-MSFT
Steve Lee (SteveL-MSFT) added this pull request to the merge queue Nov 2, 2026
Merged via the queue into PowerShell:main with commit 81a75a6 Nov 2, 2026
27 checks passed
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.

3 participants