Index: hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java (revision 1507538) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java (working copy) @@ -87,6 +87,9 @@ private static final byte[] TEST_FAM = Bytes.toBytes("fam"); private static final byte[] TEST_QUAL = Bytes.toBytes("q"); private static final byte[] TABLE_NAME = Bytes.toBytes(STRING_TABLE_NAME); + private static Path rootDir; + private static Path snapshots; + private static HMaster master; private final int DEFAULT_NUM_ROWS = 100; /** @@ -100,6 +103,9 @@ ((Log4JLogger)ScannerCallable.LOG).getLogger().setLevel(Level.ALL); setupConf(UTIL.getConfiguration()); UTIL.startMiniCluster(NUM_RS); + master = UTIL.getMiniHBaseCluster().getMaster(); + rootDir = master.getMasterFileSystem().getRootDir(); + snapshots = SnapshotDescriptionUtils.getSnapshotsDir(rootDir); } private static void setupConf(Configuration conf) { @@ -137,6 +143,13 @@ } catch (IOException e) { LOG.warn("Failure to delete archive directory", e); } + // delete the snapshot directory, if its exists + if (UTIL.getTestFileSystem().exists(snapshots)) { + if (!UTIL.getTestFileSystem().delete(snapshots, true)) { + throw new IOException("Couldn't delete snapshots directory (" + snapshots + + " for an unknown reason"); + } + } } @AfterClass @@ -194,10 +207,6 @@ SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), TABLE_NAME, TEST_FAM, rootDir, admin, fs, false, new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), snapshotServers); - - admin.deleteSnapshot(snapshot); - snapshots = admin.listSnapshots(); - SnapshotTestingUtils.assertNoSnapshots(admin); } @Test @@ -255,7 +264,6 @@ // make sure we don't have any snapshots SnapshotTestingUtils.assertNoSnapshots(admin); LOG.info(" === Async Snapshot Test Completed ==="); - } @Test @@ -309,10 +317,6 @@ // test that we can delete the snapshot UTIL.deleteTable(cloneAfterMergeName); UTIL.deleteTable(cloneBeforeMergeName); - admin.deleteSnapshot(snapshotBeforeMergeName); - - // make sure we don't have any snapshots - SnapshotTestingUtils.assertNoSnapshots(admin); } @Test @@ -358,10 +362,6 @@ // test that we can delete the snapshot UTIL.deleteTable(cloneName); - admin.deleteSnapshot(snapshotName); - - // make sure we don't have any snapshots - SnapshotTestingUtils.assertNoSnapshots(admin); } /** @@ -417,15 +417,6 @@ // make sure we have some file references assertTrue(fs.listStatus(familyDir).length > 0); } - - // test that we can delete the snapshot - admin.deleteSnapshot(snapshotName); - FSUtils.logFileSystemState(UTIL.getTestFileSystem(), - FSUtils.getRootDir(UTIL.getConfiguration()), LOG); - - // make sure we don't have any snapshots - SnapshotTestingUtils.assertNoSnapshots(admin); - LOG.debug("------- Flush-Snapshot Create List Destroy-------------"); } /**