14:20:39Ap0geeIs there an idiomatic way to test parallel processes?
14:20:52Ap0geeI want to write unit tests for processes using pexec from chanl
14:21:12Ap0geeObviously I can just sleep x but that feels fragile
14:23:03pjbAp0gee: the point of parallel process is to be independent.
14:23:28pjbAp0gee: so you could 1- test them sequentially in any order (a first sanity check). and
14:24:11pjbAp0gee: 2- test them in parallel, still independently, in separate threads. To run the tests, you'll need a thread-safe test framework, and not forget to thread-join the threads at the end, before reporting the results.
14:26:09pjbAp0gee: now, of course, the parallel processes may sometimes need to have synchronisation between them. (eg. a consummer and a producer). In that case, you may try to test different situations by adding delays, or other modifications to the code, but it would be more testing the synchronization primitives than anything else. Better modelize the processes and prove they should work, using eg. CSP.