-
-
Notifications
You must be signed in to change notification settings - Fork 477
Support -Timeout for test cases #983
Copy link
Copy link
Closed
Labels
Description
1. Provide a general summary of the issue in the Title above
For PSCore6, we've had to create a custom test function so that tests don't hang during execution (eventually timing out in CI).
It would be ideal if It had a parameter to specify -Timeoutms and fail the test case.
2. Describe Your Environment
Operating System, Pester version and PowerShell version:
Pester version : 4.1.1 /Users/steve/.local/share/powershell/Modules/Pester/4.1.1/Pester.psm1
PowerShell version : 6.0.1
OS version : Unix 17.4.0.03. Expected Behavior
It "Timeout test" -Timeoutms 500 {
Start-Sleep -Seconds 1
}
# this should result in the test failing due to timeout, aftereach/afterall should still be called, applies to individual test cases4.Current Behavior
Need to implement custom timeout function and use it everywhere applicable
5. Possible Solution
In PSCore6.1 we may be able to add -Timeout to Invoke-Command, but for compatibility reasons, you may use something like the custom function we have above.
6. Context
Usually webcmdlet tests that need to call external URLs cause problems if the web server doesn't respond. Although the webcmdlets themselves have a timeout, this affects the code logic and what is actually being tested.
Reactions are currently unavailable