tests: Avoid race condition in flow monitoring test.