Skip to content

Commit 09bf0c5

Browse files
committed
update tests based on product change
1 parent 460a5fd commit 09bf0c5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

runcommandonset/tests/runcommandonset.set.tests.ps1

+10-10
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ Describe 'tests for runcommandonset set' {
3636
"arguments": ["-Command", "echo hello world"]
3737
}
3838
"@
39-
$input_json | runcommandonset set 2> $TestDrive/output.txt
40-
$actual = Get-Content -Path $TestDrive/output.txt
41-
$actual | Should -Contain 'Stdout: hello'
42-
$actual | Should -Contain 'world'
39+
$input_json | runcommandonset --trace-level trace --trace-format plaintext set 2> $TestDrive/output.txt
40+
$actual = Get-Content -Path $TestDrive/output.txt -Raw
41+
$actual | Should -BeLike '*Stdout: hello*'
42+
$actual | Should -BeLike '*world*'
4343
$LASTEXITCODE | Should -Be 0
4444
}
4545

4646
It 'STDERR captured when calling resource directly with invalid args' {
47-
$json = runcommandonset set -e pwsh -a "echo hello world" 2> $TestDrive/output.txt
47+
$json = runcommandonset --trace-level trace --trace-format plaintext set -e pwsh -a "echo hello world" 2> $TestDrive/output.txt
4848
$stdout = $json | ConvertFrom-Json
4949
$stdout.exitCode | Should -Be 64
50-
$expected = "Stderr: The argument 'echo hello world' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
51-
$stderr = Get-Content -Path $TestDrive/output.txt
52-
$stderr | Should -Contain $expected
50+
$expected = "*Stderr: The argument 'echo hello world' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.*"
51+
$stderr = Get-Content -Path $TestDrive/output.txt -Raw
52+
$stderr | Should -BeLike $expected
5353
$LASTEXITCODE | Should -Be 0
5454
}
5555

@@ -78,9 +78,9 @@ Describe 'tests for runcommandonset set' {
7878
It 'Executable does not exist' {
7979
'{ "executable": "foo" }' | dsc -l trace resource set -r Microsoft.DSC.Transitional/RunCommandOnSet -f - 2> $TestDrive/output.txt
8080
$actual = Get-Content -Path $TestDrive/output.txt -Raw
81-
$expected_logging = 'Failed to execute foo: No such file or directory (os error 2)'
81+
$expected_logging = "Failed to execute 'foo': No such file or directory (os error 2)"
8282
if ($IsWindows) {
83-
$expected_logging = 'Failed to execute foo: program not found'
83+
$expected_logging = "Failed to execute 'foo': program not found"
8484
}
8585
$actual | Should -BeLike "*$expected_logging*"
8686
$LASTEXITCODE | Should -Be 2

0 commit comments

Comments
 (0)