Fix data races in state/apiserver tests