server: fix data races in tests