We do something similar in tests/replicaset/legacy/bug00522.phpt but I agree that this could be a race condition. I've moved it to the "bridge" section.