@After
  public void tearDown() throws KeeperException, ZooKeeperConnectionException, IOException {
    // Make sure zk is clean before we run the next test.
    ZKWatcher zkw = new ZKWatcher(TESTUTIL.getConfiguration(), "@Before", new Abortable() {
      @Override
      public void abort(String why, Throwable e) {
        throw new RuntimeException(why, e);
      }

      @Override
      public boolean isAborted() {
        return false;
      }
    });
    // Before fails sometimes so retry.
    try {
      TESTUTIL.waitFor(10000, (Waiter.Predicate<Exception>) () -> {
        try {
          ZKUtil.deleteNodeRecursively(zkw, zkw.getZNodePaths().baseZNode);
          return true;
        } catch (KeeperException.NotEmptyException e) {
          LOG.info("Failed delete, retrying", e);
        }
        return false;
      });
    } catch (Exception e) {
      LOG.info("Failed zk clear", e);
    }
    zkw.close();
  }
Standup the master and fake it to test various aspects of master function. Does NOT spin up a
mini hbase nor mini dfs cluster testing master (it does put up a zk cluster but this is usually
pretty fast compared). Also, should be possible to inject faults at points difficult to get at in
cluster context. TODO: Speed up the zk connection by Master. It pauses 5 seconds establishing
session.
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java