File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,12 @@ Describe PSParallelPipeline {
137
137
138
138
Context ' TimeoutSeconds Parameter' {
139
139
It ' Stops processing after the specified seconds' {
140
+ $wait = 5
141
+ if (-not $IsCoreCLR ) {
142
+ # because pwsh 5.1 fucking sucks!
143
+ $wait = 10
144
+ }
145
+
140
146
Assert-RunspaceCount {
141
147
$timer = [Stopwatch ]::StartNew()
142
148
{
@@ -150,7 +156,7 @@ Describe PSParallelPipeline {
150
156
} | Should - Throw - ExceptionType ([TimeoutException ])
151
157
$timer.Stop ()
152
158
$timer.Elapsed | Should - BeLessOrEqual ([timespan ]::FromSeconds(2.2 ))
153
- }
159
+ } - WaitSeconds $wait
154
160
}
155
161
}
156
162
Original file line number Diff line number Diff line change @@ -20,15 +20,18 @@ function Assert-RunspaceCount {
20
20
[CmdletBinding ()]
21
21
param (
22
22
[Parameter (Mandatory )]
23
- [scriptblock ] $ScriptBlock
23
+ [scriptblock ] $ScriptBlock ,
24
+
25
+ [Parameter ()]
26
+ [int ] $WaitSeconds = 5
24
27
)
25
28
26
29
try {
27
30
$count = @ (Get-Runspace ).Count
28
31
& $ScriptBlock
29
32
}
30
33
finally {
31
- Start-Sleep 5
34
+ Start-Sleep $WaitSeconds
32
35
Get-Runspace |
33
36
Should - HaveCount $count - Because ' Runspaces should be correctly disposed'
34
37
}
You can’t perform that action at this time.
0 commit comments