From cbb7cc26a547476691472f9fe448c6fe3864faaf Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Wed, 12 Apr 2017 12:09:10 -0700 Subject: [PATCH] HDFS-11642. Block Storage: fix TestCBlockCLI and TestCBlockServerPersistence cleanup. Contributed by Xiaoyu Yao. --- .../test/java/org/apache/hadoop/cblock/TestCBlockServer.java | 1 + .../apache/hadoop/cblock/TestCBlockServerPersistence.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/cblock/TestCBlockServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/cblock/TestCBlockServer.java index 4f816e154d..1efef3e805 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/cblock/TestCBlockServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/cblock/TestCBlockServer.java @@ -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 diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/cblock/TestCBlockServerPersistence.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/cblock/TestCBlockServerPersistence.java index 3e212d52d4..0dee7bbcd4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/cblock/TestCBlockServerPersistence.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/cblock/TestCBlockServerPersistence.java @@ -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 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 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(); } }