HDFS-5615: refactor for sharing test cluster init logic