Make tests more robust to handle CI behavior.