Skip to content

Commit

Permalink
removed json check in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anmenaga committed Jan 15, 2025
1 parent 6f63f01 commit fa6ba24
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
12 changes: 5 additions & 7 deletions dsc/tests/dsc_config_get.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,15 @@ Describe 'dsc config get tests' {
properties:
output: hello
"@
$config_yaml | dsc config get --output-format json -f - 2> $TestDrive/ErrorStream.txt
$config_yaml | dsc -t json config get --output-format json -f - 2> $TestDrive/ErrorStream.txt
$LASTEXITCODE | Should -Be 0
$lines = Get-Content $TestDrive/ErrorStream.txt
$ProgressMessagesFound = $False
foreach ($line in $lines) {
if ($line.StartsWith('{')) {
$jp = $line | ConvertFrom-Json
if ($jp.activity) { # if line is a progress message
$jp.percent_complete | Should -BeIn (0..100)
$ProgressMessagesFound = $True
}
$jp = $line | ConvertFrom-Json
if ($jp.activity) { # if line is a progress message
$jp.percent_complete | Should -BeIn (0..100)
$ProgressMessagesFound = $True
}
}
$ProgressMessagesFound | Should -BeTrue
Expand Down
12 changes: 5 additions & 7 deletions dsc/tests/dsc_resource_list.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,15 @@ Describe 'Tests for listing resources' {
}

It 'json progress for resource subcommand' {
dsc resource list -o json -a '*' 2> $TestDrive/ErrorStream.txt
dsc -t json resource list -o json -a '*' 2> $TestDrive/ErrorStream.txt
$LASTEXITCODE | Should -Be 0
$lines = Get-Content $TestDrive/ErrorStream.txt
$ProgressMessagesFound = $False
foreach ($line in $lines) {
if ($line.StartsWith('{')) {
$jp = $line | ConvertFrom-Json
if ($jp.activity) { # if line is a progress message
$jp.percent_complete | Should -BeIn (0..100)
$ProgressMessagesFound = $True
}
$jp = $line | ConvertFrom-Json
if ($jp.activity) { # if line is a progress message
$jp.percent_complete | Should -BeIn (0..100)
$ProgressMessagesFound = $True
}
}
$ProgressMessagesFound | Should -BeTrue
Expand Down

0 comments on commit fa6ba24

Please sign in to comment.