HBASE-9058 deleteSnapshot() call may be skipped in TestFlushSnapshotFromClient tests (Ted Yu)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1507741 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2013-07-27 22:53:40 +00:00
parent cd4414a5e4
commit 13beb54cfe
1 changed files with 4 additions and 35 deletions

View File

@ -136,6 +136,10 @@ public class TestFlushSnapshotFromClient {
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Failure to delete archive directory", e); LOG.warn("Failure to delete archive directory", e);
} }
for (SnapshotDescription snapshot: UTIL.getHBaseAdmin().listSnapshots()) {
UTIL.getHBaseAdmin().deleteSnapshot(snapshot.getName());
}
SnapshotTestingUtils.assertNoSnapshots(UTIL.getHBaseAdmin());
} }
@AfterClass @AfterClass
@ -193,10 +197,6 @@ public class TestFlushSnapshotFromClient {
SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), TABLE_NAME, TEST_FAM, rootDir, SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), TABLE_NAME, TEST_FAM, rootDir,
admin, fs, false, new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), snapshotServers); admin, fs, false, new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), snapshotServers);
admin.deleteSnapshot(snapshot);
snapshots = admin.listSnapshots();
SnapshotTestingUtils.assertNoSnapshots(admin);
} }
@Test @Test
@ -245,16 +245,6 @@ public class TestFlushSnapshotFromClient {
FSUtils.getRootDir(UTIL.getConfiguration()), LOG); FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
// make sure we get the snapshot // make sure we get the snapshot
SnapshotTestingUtils.assertOneSnapshotThatMatches(admin, snapshot); SnapshotTestingUtils.assertOneSnapshotThatMatches(admin, snapshot);
// test that we can delete the snapshot
admin.deleteSnapshot(snapshot.getName());
LOG.info(" === Async Snapshot Deleted ===");
FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
// make sure we don't have any snapshots
SnapshotTestingUtils.assertNoSnapshots(admin);
LOG.info(" === Async Snapshot Test Completed ===");
} }
@Test @Test
@ -308,10 +298,6 @@ public class TestFlushSnapshotFromClient {
// test that we can delete the snapshot // test that we can delete the snapshot
UTIL.deleteTable(cloneAfterMergeName); UTIL.deleteTable(cloneAfterMergeName);
UTIL.deleteTable(cloneBeforeMergeName); UTIL.deleteTable(cloneBeforeMergeName);
admin.deleteSnapshot(snapshotBeforeMergeName);
// make sure we don't have any snapshots
SnapshotTestingUtils.assertNoSnapshots(admin);
} }
@Test @Test
@ -357,10 +343,6 @@ public class TestFlushSnapshotFromClient {
// test that we can delete the snapshot // test that we can delete the snapshot
UTIL.deleteTable(cloneName); UTIL.deleteTable(cloneName);
admin.deleteSnapshot(snapshotName);
// make sure we don't have any snapshots
SnapshotTestingUtils.assertNoSnapshots(admin);
} }
/** /**
@ -417,15 +399,6 @@ public class TestFlushSnapshotFromClient {
// make sure we have some file references // make sure we have some file references
assertTrue(fs.listStatus(familyDir).length > 0); 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-------------");
} }
/** /**
@ -534,10 +507,6 @@ public class TestFlushSnapshotFromClient {
assertTrue("We expect at least 1 snapshot of table1 ", t1SnapshotsCount > 0); assertTrue("We expect at least 1 snapshot of table1 ", t1SnapshotsCount > 0);
assertTrue("We expect at least 1 snapshot of table2 ", t2SnapshotsCount > 0); assertTrue("We expect at least 1 snapshot of table2 ", t2SnapshotsCount > 0);
// delete snapshots so subsequent tests are clean.
for (SnapshotDescription ss : taken) {
admin.deleteSnapshot(ss.getName());
}
UTIL.deleteTable(TABLE2_NAME); UTIL.deleteTable(TABLE2_NAME);
} }