raft: move test helper function into tests