Fix race conditions in tests

Signed-off-by: John Tuley <jtuley@pivotallabs.com>