HDFS-11642. Block Storage: fix TestCBlockCLI and TestCBlockServerPersistence cleanup. Contributed by Xiaoyu Yao.

This commit is contained in:
Chen Liang 2017-04-12 12:09:10 -07:00 committed by Owen O'Malley
parent 5b19a03f63
commit cbb7cc26a5
2 changed files with 6 additions and 0 deletions

View File

@ -46,6 +46,7 @@ public static void setup() throws Exception {
ScmClient storageClient = new MockStorageClient();
conf = new OzoneConfiguration();
cBlockManager = new CBlockManager(conf, storageClient);
cBlockManager.start();
}
@AfterClass

View File

@ -66,6 +66,7 @@ public void testWriteToPersistentStore() throws Exception {
try {
ScmClient storageClient = new MockStorageClient();
cBlockManager = new CBlockManager(conf, storageClient);
cBlockManager.start();
cBlockManager.createVolume(userName, volumeName1, volumeSize1, blockSize);
cBlockManager.createVolume(userName, volumeName2, volumeSize2, blockSize);
List<VolumeDescriptor> allVolumes = cBlockManager.getAllVolumes();
@ -86,6 +87,7 @@ public void testWriteToPersistentStore() throws Exception {
conf1.set(DFS_CBLOCK_SERVICE_LEVELDB_PATH_KEY, path.concat(
"/testCblockPersistence.dat"));
cBlockManager1 = new CBlockManager(conf1, storageClient1);
cBlockManager1.start();
List<VolumeDescriptor> allVolumes1 = cBlockManager1.getAllVolumes();
assertEquals(2, allVolumes1.size());
VolumeDescriptor newvolumeDescriptor1 = allVolumes1.get(0);
@ -113,6 +115,9 @@ public void testWriteToPersistentStore() throws Exception {
cBlockManager.clean();
}
if (cBlockManager1 != null) {
cBlockManager1.close();
cBlockManager1.stop();
cBlockManager1.join();
cBlockManager1.clean();
}
}