Add a test for the powershell hang fix (#5451)
- Add test for the powershell hang fix - Ignore the 'Sync-PSTags' warning
This commit is contained in:
parent
cef7762d18
commit
c4f0d1c893
|
@ -568,7 +568,7 @@ Fix steps:
|
|||
if ($ReleaseTagToUse) {
|
||||
$ReleaseVersion = $ReleaseTagToUse
|
||||
} else {
|
||||
$ReleaseVersion = (Get-PSCommitId) -replace '^v'
|
||||
$ReleaseVersion = (Get-PSCommitId -WarningAction SilentlyContinue) -replace '^v'
|
||||
}
|
||||
|
||||
Start-NativeExecution { & "~/.rcedit/rcedit-x64.exe" "$($Options.Output)" --set-icon "$PSScriptRoot\assets\Powershell_black.ico" `
|
||||
|
|
|
@ -21,3 +21,27 @@ Describe 'Basic engine APIs' -Tags "CI" {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Clean up open Runspaces when exit powershell process" -Tags "Feature" {
|
||||
It "PowerShell process should not freeze at exit" {
|
||||
$command = @'
|
||||
-c $rs = [runspacefactory]::CreateRunspacePool(1,5)
|
||||
$rs.Open()
|
||||
$ps = [powershell]::Create()
|
||||
$ps.RunspacePool = $rs
|
||||
$null = $ps.AddScript(1).Invoke()
|
||||
write-host should_not_hang_at_exit
|
||||
exit
|
||||
'@
|
||||
$process = Start-Process pwsh -ArgumentList $command -PassThru
|
||||
Wait-UntilTrue -sb { $process.HasExited } -TimeoutInMilliseconds 5000 -IntervalInMilliseconds 1000 > $null
|
||||
|
||||
$expect = "powershell process exits in 5 seconds"
|
||||
if (-not $process.HasExited) {
|
||||
Stop-Process -InputObject $process -Force -ErrorAction SilentlyContinue
|
||||
"powershell process doesn't exit in 5 seconds" | Should Be $expect
|
||||
} else {
|
||||
$expect | Should Be $expect
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue