Skip to content

Commit 7dc84f2

Browse files
authored
Merge pull request #319 from SteveL-MSFT/osinfo=tests
add tests for osinfo parameters examples
2 parents 2f4670c + 2106cf4 commit 7dc84f2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

dsc/tests/dsc_osinfo.tests.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Describe 'Tests for osinfo examples' {
2+
It 'Config with default parameters and get works' {
3+
$out = dsc config get -p $PSScriptRoot/../examples/osinfo_parameters.dsc.yaml | ConvertFrom-Json -Depth 10
4+
$LASTEXITCODE | Should -Be 0
5+
$expected = if ($IsWindows) {
6+
'Windows'
7+
} elseif ($IsLinux) {
8+
'Linux'
9+
} else {
10+
'macOS'
11+
}
12+
13+
$out.results[0].result.actualState.family | Should -BeExactly $expected
14+
}
15+
16+
It 'Config test works' {
17+
$out = dsc config -f $PSScriptRoot/../examples/osinfo.parameters.yaml test -p $PSScriptRoot/../examples/osinfo_parameters.dsc.yaml | ConvertFrom-Json -Depth 10
18+
$LASTEXITCODE | Should -Be 0
19+
$out.results[0].result.inDesiredState | Should -Be $IsMacOS
20+
}
21+
}

0 commit comments

Comments
 (0)