intelligently wait for replication in test