Skip to content

Commit a0f1079

Browse files
SteveL-MSFTSteve Lee (POWERSHELL HE/HIM) (from Dev Box)
authored andcommitted
fix tests
1 parent 2abfb00 commit a0f1079

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

dsc/tests/dsc_discovery.tests.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,19 @@ Describe 'tests for resource discovery' {
175175
) {
176176
param($cmdline)
177177

178-
Invoke-Expression $cmdline 2>$null
178+
$out = dsc resource get -r abc/def 2>$null
179+
$LASTEXITCODE | Should -Be 7
180+
$out = dsc resource get --all -r abc/def 2>$null
181+
$LASTEXITCODE | Should -Be 7
182+
$out = 'abc' | dsc resource set -r abc/def -f - 2>$null
183+
$LASTEXITCODE | Should -Be 7
184+
$out = 'abc' | dsc resource test -r abc/def -f - 2>$null
185+
$LASTEXITCODE | Should -Be 7
186+
$out = 'abc' | dsc resource delete -r abc/def -f - 2>$null
187+
$LASTEXITCODE | Should -Be 7
188+
$out = dsc resource export -r abc/def 2>$null
189+
$LASTEXITCODE | Should -Be 7
190+
$out = dsc resource schema -r abc/def 2>$null
179191
$LASTEXITCODE | Should -Be 7
180192
}
181193

powershell-adapter/Tests/powershellgroup.resource.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Describe 'PowerShell adapter resource tests' {
112112

113113
It 'Get --all works on PS class-based resource' -Pending {
114114

115-
$r = dsc resource get --all -r TestClassResource/TestClassResource
115+
$r = dsc resource get --all -r TestClassResource/TestClassResource 2>$null
116116
$LASTEXITCODE | Should -Be 0
117117
$res = $r | ConvertFrom-Json
118118
$res.actualState.result.count | Should -Be 5

powershell-adapter/Tests/win_powershellgroup.tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ resources:
209209
}
210210

211211
It 'Get works with class-based PS DSC resources' {
212-
$out = dsc resource get -r PSClassResource/PSClassResource --input (@{Name = 'TestName' } 2> "$testdrive/error.log" | ConvertTo-Json) | ConvertFrom-Json
212+
$out = dsc resource get -r PSClassResource/PSClassResource --input (@{Name = 'TestName' } | ConvertTo-Json) 2> "$testdrive/error.log" | ConvertFrom-Json
213213
$LASTEXITCODE | Should -Be 0 -Because (Get-Content -Path "$testdrive/error.log" -Raw | Out-String)
214214
$out.actualState.Name | Should -Be 'TestName'
215215
$out.actualState.Ensure | Should -Be 'Present'
@@ -218,7 +218,7 @@ resources:
218218
}
219219

220220
It 'Set works with class-based PS DSC resources' {
221-
$out = dsc resource set -r PSClassResource/PSClassResource --input (@{Name = 'TestName' } 2> "$testdrive/error.log" | ConvertTo-Json) | ConvertFrom-Json
221+
$out = dsc resource set -r PSClassResource/PSClassResource --input (@{Name = 'TestName' } | ConvertTo-Json) 2> "$testdrive/error.log" | ConvertFrom-Json
222222
$LASTEXITCODE | Should -Be 0 -Because (Get-Content -Path "$testdrive/error.log" -Raw | Out-String)
223223
$out.afterstate.InDesiredState | Should -Be $true
224224
}

0 commit comments

Comments
 (0)