Fixes race condition in test. Closes #9389.

Signed-off-by: Emily Maier <emily@emilymaier.net>
Merge pull request #9400 from emilymaier/9389-fix

Fixes race condition in test. Closes #9389.