Add unit tests for `JsonRpcConnection` connection handling
For now, this just tests the connection handling part, since doing the PKI stuff here felt out of place. I'll probably add that to the ApiListener tests once I get to it.
Closes #10522
Also, I'm not convinced by all the assertion macros you added; for example, the logging related ones just call a non-static member function of a fixture class, but don't require an instance of that class as an argument or the like.
I'm happy to take suggestions on the naming and interface of the timed asserts. But they're definitely something that's useful (at least to me), because I kept running into this pattern and that would actually be boilerplate if we had to repeat it for every test-suite/case.
The logging related ones are more for visual consistency (because to be useful you'd have to always wrap the methods in a BOOST_(TEST|CHECK|REQUIRE) anyways) than anything else. I don't think implicitly requiring the fixture in whose header they're defined in is a problem. Worst case they'd print a pretty clear compiler error and the user would just add the fixture to their test case. I can even add an #error with a special message if that's your fear. But I'm open to other suggestions or ultimately removing them entirely.
I just failed to see the usefulness of the
*_DONE_*macros. They're basically the same as the other*_WITHIN_*macros, but they just differ in the result message they produce. Can't you just use the later ones everywhere and be done with it? If the difference is indeed required, then I'm just confused.
Again, the naming is debatable, I was just out of ideas and it could be improved, but the two groups do completely different things.
The DONE ones wait for a blocking/long-running operation to complete and then check if it has finished within the asserted boundaries, the other ones sample a condition over and over to get the exact time when it changes from false to true (or vice versa) within the asserted boundaries.