There is a race condition in the TransactionCoordinatorMetricsTests between when we stop capturing the test's log messages stream and the completion of the asynchronous completion of the transaction coordinator, which might not have gotten to log the slow transaction message by that time.
In order to fix it, we should wait for the onCompletion notification on the TransactionCoordinator to fire before we stop recording the log messages.