@Test
  public void testCheckNoTempDir() throws Exception {
    final MasterFileSystem masterFileSystem =
      UTIL.getMiniHBaseCluster().getMaster().getMasterFileSystem();

    final TableName tableName = TableName.valueOf(name.getMethodName());
    final byte[] FAM = Bytes.toBytes("fam");
    final byte[][] splitKeys =
      new byte[][] { Bytes.toBytes("b"), Bytes.toBytes("c"), Bytes.toBytes("d") };

    UTIL.createTable(tableName, FAM, splitKeys);

    // get the current store files for the regions
    List<HRegion> regions = UTIL.getHBaseCluster().getRegions(tableName);
    // make sure we have 4 regions serving this table
    assertEquals(4, regions.size());

    // load the table
    try (Table table = UTIL.getConnection().getTable(tableName)) {
      UTIL.loadTable(table, FAM);
    }

    // disable the table so that we can manipulate the files
    UTIL.getAdmin().disableTable(tableName);

    final Path tempDir = masterFileSystem.getTempDir();
    final Path tempNsDir = CommonFSUtils.getNamespaceDir(tempDir, tableName.getNamespaceAsString());
    final FileSystem fs = masterFileSystem.getFileSystem();

    // checks the temporary directory does not exist
    assertFalse(fs.exists(tempNsDir));

    UTIL.deleteTable(tableName);
  }
Test the master filesystem in a local cluster
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFileSystem.java