Skip to content
Merged
Changes from all commits
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
11 changes: 7 additions & 4 deletions test/powershell/Host/Logging.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,15 @@ $PID

It 'Verifies logging level filtering works' -Skip:(!$IsSupportedEnvironment) {
$configFile = WriteLogSettings -LogId $logId -LogLevel Warning
& $powershell -NoProfile -SettingsFile $configFile -Command '$env:PSModulePath | out-null'
$result = & $powershell -NoProfile -SettingsFile $configFile -Command '$PID'
$result | Should -Not -BeNullOrEmpty

# by default, PowerShell only logs informational events on startup. With Level = Warning, nothing should
# have been logged.
$items = Get-PSSysLog -Path $SyslogFile -Id $logId -Tail 100 -TotalCount 1
$items | Should -Be $null
# have been logged. We'll collect all the syslog entries and look for $PID (there should be none).
$items = Get-PSSysLog -Path $SyslogFile
@($items).Count | Should -BeGreaterThan 0
$logs = $items | Where-Object { $_.ProcessId -eq $result }
$logs | Should -BeNullOrEmpty
Comment on lines +256 to +259
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the test previously assumed there would be no entries, but now we expect some entries but none with the PID data. What's changed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was added to make it more robust.

}
}

Expand Down