You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a script being tested has concurrent executions of a stubbed command there is a race condition. In particular, concurrent executions only consume a single stub execution plan but if one of the concurrent calls starts after one of the others has finished it will fail the stub due to a missing or unmatched plan. What's worse, if the failure path finishes before one othe other concurrent executions already in progress, it will not even be properly recorded and the stub will record as being called just fine :(
In the example, the stub is of a single command called 3 times and found that testing that functionality results in a flaky test that can fail either on the unstubbing or due to other checks in the same tests due to the failed stub execution
From a PR in the Buildkite test-collector plugin.
When a script being tested has concurrent executions of a stubbed command there is a race condition. In particular, concurrent executions only consume a single stub execution plan but if one of the concurrent calls starts after one of the others has finished it will fail the stub due to a missing or unmatched plan. What's worse, if the failure path finishes before one othe other concurrent executions already in progress, it will not even be properly recorded and the stub will record as being called just fine :(
In the example, the stub is of a single command called 3 times and found that testing that functionality results in a flaky test that can fail either on the unstubbing or due to other checks in the same tests due to the failed stub execution
Original test with correct execution order
Race condition that causes the
unstub
call to fail:Race condition that does not make
unstub
failThe text was updated successfully, but these errors were encountered: