fix for posible race conditions in tests
Merge pull request #872 from realm/al-race

Fix for posible race conditions in tests