test/worker: fix race conditions in tests