use a waitgroup not sleep for tests