public static void testWrite() throws Exception {
   FileSystem fs = cluster.getFileSystem();
   long tStart = System.currentTimeMillis();
   bench.writeTest(fs);
   long execTime = System.currentTimeMillis() - tStart;
   bench.analyzeResult(fs, TestType.TEST_TYPE_WRITE, execTime);
 }
 @Test(timeout = 6000)
 public void testAppend() throws Exception {
   FileSystem fs = cluster.getFileSystem();
   long tStart = System.currentTimeMillis();
   bench.appendTest(fs);
   long execTime = System.currentTimeMillis() - tStart;
   bench.analyzeResult(fs, TestType.TEST_TYPE_APPEND, execTime);
 }
 @Test(timeout = 3000)
 public void testReadSkip() throws Exception {
   FileSystem fs = cluster.getFileSystem();
   long tStart = System.currentTimeMillis();
   bench.getConf().setLong("test.io.skip.size", 1);
   bench.randomReadTest(fs);
   long execTime = System.currentTimeMillis() - tStart;
   bench.analyzeResult(fs, TestType.TEST_TYPE_READ_SKIP, execTime);
 }
 @Test(timeout = 3000)
 public void testReadBackward() throws Exception {
   FileSystem fs = cluster.getFileSystem();
   long tStart = System.currentTimeMillis();
   bench.getConf().setLong("test.io.skip.size", -DEFAULT_BUFFER_SIZE);
   bench.randomReadTest(fs);
   long execTime = System.currentTimeMillis() - tStart;
   bench.analyzeResult(fs, TestType.TEST_TYPE_READ_BACKWARD, execTime);
 }
  @BeforeClass
  public static void beforeClass() throws Exception {
    bench = new TestDFSIO();
    bench.getConf().setBoolean(DFSConfigKeys.DFS_SUPPORT_APPEND_KEY, true);
    cluster = new MiniDFSCluster.Builder(bench.getConf()).numDataNodes(2).format(true).build();
    FileSystem fs = cluster.getFileSystem();
    bench.createControlFile(fs, DEFAULT_NR_BYTES, DEFAULT_NR_FILES);

    /** Check write here, as it is required for other tests */
    testWrite();
  }
 @AfterClass
 public static void afterClass() throws Exception {
   if (cluster == null) return;
   FileSystem fs = cluster.getFileSystem();
   bench.cleanup(fs);
   cluster.shutdown();
 }