Fix race conditions with logrus testing
logrus fires a Goroutine to write logs (https://github.com/sirupsen/logrus/blob/60c74ad9be0d874af0ab0daef6ab07c5c5911f0d/writer.go#L51), so the tests could fail if they checked the event queue before the logrus have fired. Since there isn't an easy way to flush all outstanding hooks (https://github.com/sirupsen/logrus/issues/435), we just retry every 100 ms for up to a second for log to arrive in the queue.
Closes #450 (closed)
Edited by Stan Hu