Make tests more resilient to timing issues
Make tests more resilient to timing issues

Because there are multiple threads it can take an operation longer than
expected to complete. This commit updates the `wait` command in the
tests to take a block and retry failing asserts for a time instead of
just introducing a constant sleep. This appears to fix the random
failures after many full test runs.

expectedbehavior/instrumental_agent