mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix an intermittent failure in macOS logging tests (#8385)
Fix an intermittent failure in macOS logging tests - make tests wait for the correct number of log entries - make tests not fail with an `Index was outside the bounds of the array.` error
This commit is contained in:
@@ -311,12 +311,12 @@ Path:.*
|
||||
$configFile = WriteLogSettings -LogId $logId
|
||||
$testPid = & $powershell -NoProfile -SettingsFile $configFile -Command '$PID'
|
||||
|
||||
Export-PSOsLog -After $after -LogPid $testPid -TimeoutInMilliseconds 30000 -IntervalInMilliseconds 3000 -MinimumCount 2 |
|
||||
Export-PSOsLog -After $after -LogPid $testPid -TimeoutInMilliseconds 30000 -IntervalInMilliseconds 3000 -MinimumCount 3 |
|
||||
Set-Content -Path $contentFile
|
||||
$items = @(Get-PSOsLog -Path $contentFile -Id $logId -After $after -TotalCount 3 -Verbose)
|
||||
|
||||
$items | Should -Not -Be $null
|
||||
$items.Count | Should -BeGreaterThan 1
|
||||
$items.Count | Should -BeGreaterThan 2
|
||||
$items[0].EventId | Should -BeExactly 'Perftrack_ConsoleStartupStart:PowershellConsoleStartup.WinStart.Informational'
|
||||
$items[1].EventId | Should -BeExactly 'NamedPipeIPC_ServerListenerStarted:NamedPipe.Open.Informational'
|
||||
$items[2].EventId | Should -BeExactly 'Perftrack_ConsoleStartupStop:PowershellConsoleStartup.WinStop.Informational'
|
||||
|
||||
Reference in New Issue
Block a user