Skip to content

Commit

Permalink
updated config test
Browse files Browse the repository at this point in the history
  • Loading branch information
anmenaga committed Dec 12, 2024
1 parent 0b03abf commit 23ce52e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
22 changes: 22 additions & 0 deletions dsc/tests/dsc_config_get.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,26 @@ Describe 'dsc config get tests' {
$result.metadata.'Microsoft.DSC'.securityContext | Should -Not -BeNullOrEmpty
$LASTEXITCODE | Should -Be 0
}

It 'json progress for config subcommand' {
$config_yaml = @"
`$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: hello
"@
$config_yaml | dsc 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.Contains("activity")) { # if line is a progress message
$line.Contains("percent_complete") | Should -BeTrue
$ProgressMessagesFound = $True
}
}
$ProgressMessagesFound | Should -BeTrue
}
}
1 change: 0 additions & 1 deletion dsc_lib/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ impl DscProgressBar {
if self.length > 0 {
self.progress_value.percent_complete = if self.position >= self.length {100}
else { ((self.position * 100) / self.length) as u16};
self.emit_json();
}
}

Expand Down

0 comments on commit 23ce52e

Please sign in to comment.