Repository navigation
Fix DSC checks for local repository paths - #2081
Open
Dimitriy Leontev (dleontev) wants to merge 2 commits into
Open
Dimitriy Leontev (dleontev) wants to merge 2 commits into
Dimitriy Leontev (dleontev) 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.
🟡 Changes recommended
Repository drift tests omit independent changes to trusted, priority, and repositoryType, leaving unverified whether DSC detects those differences and converges rather than silently skipping updates.
1 open issue
What changed in this PR
Adds native DSC testing for the Repository resource to address #2055, allowing equivalent local paths and file URIs to be recognized as the same repository.
Changes:
- Compare configured properties with actual repository state and report differences.
- Add read-only test status while excluding it from exports.
- Add regression coverage for repeated local-path applies and URI changes.
| File | Description |
|---|---|
test/DscResource/PSResourceGetDSCResource.Tests.ps1 |
Adds local repository lifecycle and export-status assertions. |
src/dsc/repository.dsc.resource.json |
Declares the native test operation and read-only status property. |
src/dsc/psresourceget.ps1 |
Implements repository comparison, shared retrieval, and export serialization. |
Review effort: Balanced
Add independent cases for trust, priority and repository type. Verify exact drift properties, applied values and convergence.
This branch has not been deployed
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.

PR Summary
Add a native test operation to the DSC Repository resource. Compare absolute local paths and file URIs in the same canonical form so a second
dsc config setskips a repository that already matches. Report the differing properties when the URI or another configured property actually changes.Fixes #2055.
PR Context
Registering a path like
C:\Repostores a URI likefile:///C:/Repo. DSC's synthetic test compares the strings and treats the repository as out of state. The native test returns the actual state and the properties that differ. Exported configurations omit the read-only DSC test status.The new repository lifecycle test failed on upstream and passed with the patch. The Release build passed, followed by 12 Pester repository and schema tests on DSC 3.3.0 and 13 CLI checks each on DSC 3.2.0 and 3.3.0. The CLI checks confirmed that a second apply skips the repository-store write and that a different path still updates the registration. Validation ran on PowerShell 7.6.5 for Windows. PSScriptAnalyzer reported no new findings.
Codex assisted with the implementation and validation.
PR Checklist