Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add invalid params test case
  • Loading branch information
SteveL-MSFT committed Jun 5, 2025
commit 4af0eb479c728bb93d7df9b65404acdc7c8317a9
12 changes: 12 additions & 0 deletions dsc/tests/dsc_parameters.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,16 @@ Describe 'Parameters tests' {
$errorMessage = Get-Content -Path $TestDrive/error.log -Raw
$errorMessage | Should -BeLike "*ERROR*Cannot read from STDIN for both parameters and input*"
}

It 'Invalid parameters read from STDIN result in error' {
$params = @{
osFamily = 'Windows'
} | ConvertTo-Json -Compress

$out = $params | dsc config -f - test -f "$PSScriptRoot/../examples/osinfo_parameters.dsc.yaml" 2> $TestDrive/error.log
$LASTEXITCODE | Should -Be 4
$out | Should -BeNullOrEmpty
$errorMessage = Get-Content -Path $TestDrive/error.log -Raw
$errorMessage | Should -BeLike "*ERROR*Parameter input failure: JSON: missing field ````parameters````*"
}
}
Loading