From 4c527284b55a94b1759de04b5af0bc05ce854f6b Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Fri, 6 Sep 2024 16:59:19 -0700 Subject: [PATCH] add test --- dsc/tests/dsc_tracing.tests.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dsc/tests/dsc_tracing.tests.ps1 b/dsc/tests/dsc_tracing.tests.ps1 index 56698ac0..23355531 100644 --- a/dsc/tests/dsc_tracing.tests.ps1 +++ b/dsc/tests/dsc_tracing.tests.ps1 @@ -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 + } }