Fixing a race condition in tests

Signed-off-by: Johannes Tuchscherer <jtuchscherer@pivotallabs.com>