-
-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Hi! I have a fairly complex script that I can't provide, but the basic gist of it is:
call the perforce helix command (p4.exe)
if perforce exits with an errorcode 1, or has no resulting output, then print a bunch of verbose diagnosis stuff, and then throw.
The test is simple:
It "Port option works" {
InModuleScope JenkinsModule {
{ Invoke-Perforce -Command "info" -Port "99999" -MaxRetries 0 -RetryDelaySeconds 0 } | Should -Throw
}
}
the port option here expects to fail, because we're telling it to go to a network port that doesn't exist. Therefore, p4.exe fails, the Invoke-Perforce script throws, and .... the pester adapter puts up a bunch of stuff in the corner notification area, but the test just silently doesn't get marked as passed or failed.
The Pester error log reads:
2024-07-02 12:37:47.568 [info] Test Run Start: 1 test items
2024-07-02 12:37:49.015 [error] PesterInterface Error: Perforce client error:
2024-07-02 12:37:49.021 [error] PesterInterface Error: Connect to server failed; check $P4PORT.
2024-07-02 12:37:49.021 [error] PesterInterface Error: TCP connect to 99999 failed.
2024-07-02 12:37:49.022 [error] PesterInterface Error: TCP port number 99999 is out of range.
2024-07-02 12:37:49.059 [info] Test Run End: PesterInterface stream closed
So.. for some reason, the pester adapter is simply... dropping out.. when these perforce errors happen. I'm not sure if it's stopping the run there, or if it's just ignoring the rest of the script results after.
I suspect this is easily reproducible, but it might take me some time to build a smaller test case that I can actually provide.
However! if I set a breakpoint inside the function that is expected to throw, then tell Pester Adapter to debug the tests, the test hits that breakpoint, then if I hit continue, the test completes and is marked a success (or a failure).