Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveL-MSFT committed Sep 6, 2024
1 parent 587c379 commit 4c52728
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dsc/tests/dsc_tracing.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,16 @@ Describe 'tracing tests' {
$out = (dsc -l $level config get -d $configYaml 2> $null) | ConvertFrom-Json
$out.results[0].result.actualState.level | Should -BeExactly $level
}

It 'Pass-through tracing should only emit JSON for child processes' {
$logPath = "$TestDrive/dsc_trace.log"
$out = dsc -l info -f pass-through config get -p ../examples/groups.dsc.yaml 2> $logPath
foreach ($line in (Get-Content $logPath)) {
$line | Should -Not -BeNullOrEmpty
$json = $line | ConvertFrom-Json
$json.timestamp | Should -Not -BeNullOrEmpty
$json.level | Should -BeIn 'ERROR', 'WARN', 'INFO', 'DEBUG', 'TRACE'
}
$out | Should -BeNullOrEmpty
}
}

0 comments on commit 4c52728

Please sign in to comment.