@Test
  public void testRewritingClusterIdToPB() throws Exception {
    TEST_UTIL.startMiniZKCluster();
    TEST_UTIL.startMiniDFSCluster(1);
    TEST_UTIL.createRootDir();
    Path rootDir = CommonFSUtils.getRootDir(TEST_UTIL.getConfiguration());
    FileSystem fs = rootDir.getFileSystem(TEST_UTIL.getConfiguration());
    Path filePath = new Path(rootDir, HConstants.CLUSTER_ID_FILE_NAME);
    FSDataOutputStream s = null;
    try {
      s = fs.create(filePath);
      s.writeUTF(HBaseCommonTestingUtil.getRandomUUID().toString());
    } finally {
      if (s != null) {
        s.close();
      }
    }
    TEST_UTIL.startMiniHBaseCluster();
    HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
    assertEquals(1, master.getServerManager().getOnlineServersList().size());
  }
Test metrics incremented on region server operations.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClusterId.java