tests: flush logs before grepping them

Otherwise the test races with the daemon writing the logs and can
sometime fail.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
Merge pull request #2412 from dachary/wip-9370-flush-logs

tests: flush logs before grepping them