Improve tests port allocation