@Test
  public void testClusterId() throws Exception {
    TEST_UTIL.startMiniZKCluster();
    TEST_UTIL.startMiniDFSCluster(1);

    Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
    // start region server, needs to be separate
    // so we get an unset clusterId
    rst = JVMClusterUtil.createRegionServerThread(conf, HRegionServer.class, 0);
    rst.start();
    // Make sure RS is in blocking state
    Thread.sleep(10000);

    StartTestingClusterOption option =
      StartTestingClusterOption.builder().numMasters(1).numRegionServers(0).build();
    TEST_UTIL.startMiniHBaseCluster(option);

    rst.waitForServerOnline();

    String clusterId = ZKClusterId.readClusterIdZNode(TEST_UTIL.getZooKeeperWatcher());
    assertNotNull(clusterId);
    assertEquals(clusterId, rst.getRegionServer().getClusterId());
  }
Test metrics incremented on region server operations.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClusterId.java