Tests: unchecked SemaphoreSlim.WaitAsync(timeout) results let waits time out silently #221
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
SemaphoreSlim.WaitAsync(TimeSpan)returnsfalseon timeout instead of throwing. Test helpers insrc/ZB.MOM.WW.MxGateway.Teststhatawait sem.WaitAsync(timeout)without checking the result silently continue after a timeout, so a test can pass while the event it waited for never happened (found while writing the #205 lease-monitor tests; fixed only in that helper). Grep the Tests project for uncheckedWaitAsync(with a timeout and make each assert (Assert.True(await ...)), then mutation-check one.Fixed on main b9913188: the only unchecked timed SemaphoreSlim.WaitAsync calls in MxGateway.Tests were two start-gate waits in GatewaySessionTests (concurrent-dispose, subscriber-cap) — both now Assert.True. All other timed waits were already checked or token-only. Mutation: 200 ms gate with one permit short — old code passed silently, fixed code fails 'Timed out at the start gate'. Worker.Tests has similar patterns — filed separately. Evidence: NonWindows.slnx 0 warnings/0 errors; MxGateway.Tests 1395 passed / 2 skipped / 0 failed; converted classes 10 consecutive runs, 15/15 each.