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:
Travis Plunk
2018-12-03 14:29:49 -08:00
committed by GitHub
parent ca204599ac
commit 142814c12a
+2 -2
View File
@@ -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'