Skip to content

Commit ffa9843

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
fix case where no reboot is pending
1 parent ce37358 commit ffa9843

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

reboot_pending/tests/reboot_pending.tests.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ Describe 'reboot_pending resource tests' -Skip:(!$IsWindows -or !$isElevated) {
3838
It 'reboot_pending should have a reason' {
3939
$out = dsc resource get -r Microsoft.Windows/RebootPending | ConvertFrom-Json
4040
$LASTEXITCODE | Should -Be 0
41-
$out.actualState.reason.count | Should -BeGreaterThan 0 -Because ($out | ConvertTo-Json -Depth 10 |Out-String)
41+
if ($out.actualState.rebootPending) {
42+
$out.actualState.reason.count | Should -BeGreaterThan 0 -Because ($out | ConvertTo-Json -Depth 10 |Out-String)
43+
} else {
44+
$out.actualState.reason | Should -BeNullOrEmpty -Because ($out | ConvertTo-Json -Depth 10 |Out-String)
45+
}
4246
}
4347
}

0 commit comments

Comments
 (0)