Fix race conditions in tests

Signed-off-by: David Julia <djulia@pivotal.io>