-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #595 from SteveL-MSFT/assert-array
fix output of Assertion resource for test to resemble config and add support for array comparison
- Loading branch information
Showing
7 changed files
with
269 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
"config", | ||
"--as-group", | ||
"test", | ||
"--as-get" | ||
"--as-config" | ||
], | ||
"input": "stdin", | ||
"return": "state" | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
Describe 'dsc config test tests' { | ||
It 'Assertion works correctly' { | ||
$configYaml = @' | ||
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json | ||
resources: | ||
- name: Operating System Assertion | ||
type: Microsoft.DSC/Assertion | ||
properties: | ||
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json | ||
resources: | ||
- name: Is64BitOS | ||
type: Microsoft/OSInfo | ||
properties: | ||
bitness: '64' | ||
- name: 64bit test 2 | ||
type: Microsoft/OSInfo | ||
properties: | ||
family: Windows | ||
'@ | ||
|
||
$out = dsc config test -d $configYaml | ConvertFrom-Json | ||
$LASTEXITCODE | Should -Be 0 | ||
|
||
if ($IsWindows) { | ||
$out.results[0].result.inDesiredState | Should -BeTrue | ||
} | ||
else { | ||
$out.results[0].result.inDesiredState | Should -BeFalse | ||
$out.results[0].result.differingProperties | Should -Contain 'resources' | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.