Avoid calling real sleep() functions in unit tests
Whenever we sleep in a unit test, we should really use mocked time.
Over the years, having real sleep()
calls in unit test broke down for C tor many times. It would mainly happen when building on a slow and/or heavily loaded system. (Like, some legacy debian builders when they're under load, or somebody's raspberry pi... or even a system that is usually fast enough, running with compiler sanitizers enabled.) When that happens, it's common for the timeout not to actually be long enough for the overloaded test system to do what it's supposed to do.
We've introduced a couple more sleep() calls in the unit test as of !134 (merged); we should look for ways to remove them.