Fix test failure

This test passed locally and failed in CI because of timing issues.