-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathdsc.exit_code.tests.ps1
More file actions
26 lines (23 loc) · 996 Bytes
/
dsc.exit_code.tests.ps1
File metadata and controls
26 lines (23 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Describe 'exit code tests' {
BeforeAll {
$env:DSC_TRACE_LEVEL = 'error'
}
AfterAll {
$env:DSC_TRACE_LEVEL = $null
}
It 'non-zero exit code in manifest has corresponding message' {
dsc resource get -r Test/ExitCode --input "{ exitCode: 8 }" 2> $TestDrive/tracing.txt
"$TestDrive/tracing.txt" | Should -FileContentMatchExactly 'Placeholder from manifest for exit code 8'
}
It 'non-zero exit code not in manifest has generic message' {
dsc resource get -r Test/ExitCode --input "{ exitCode: 1 }" 2> $TestDrive/tracing.txt
"$TestDrive/tracing.txt" | Should -FileContentMatchExactly 'exit code 1'
}
It 'success exit code executes without error' {
$result = dsc resource get -r Test/ExitCode --input "{ exitCode: 0 }" | ConvertFrom-Json
$result.actualState.exitCode | Should -Be 0
$LASTEXITCODE | Should -Be 0
}
}