Fix race in test.

Change-Id: I53e1a4c5a6b5f846acd76043166b6cb7bf7d5dc7