From 583b9b418a84f3a80fa956f4ada9f90fc7f5d943 Mon Sep 17 00:00:00 2001 From: Inigo Goiri Date: Tue, 15 May 2018 10:21:42 -0700 Subject: [PATCH] HDFS-13551. TestMiniDFSCluster#testClusterSetStorageCapacity does not shut down cluster. Contributed by Anbang Hu. (cherry picked from commit 92ebd466c75275118107e6ec665cf50e337a29e7) --- .../hadoop/hdfs/TestMiniDFSCluster.java | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestMiniDFSCluster.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestMiniDFSCluster.java index afc977fc0e2..d60e0253a8d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestMiniDFSCluster.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestMiniDFSCluster.java @@ -108,29 +108,35 @@ public class TestMiniDFSCluster { capacities, defaultBlockSize, fileLen); - verifyStorageCapacity(cluster, capacities); + try { + verifyStorageCapacity(cluster, capacities); - /* restart all data nodes */ - cluster.restartDataNodes(); - cluster.waitActive(); - verifyStorageCapacity(cluster, capacities); + /* restart all data nodes */ + cluster.restartDataNodes(); + cluster.waitActive(); + verifyStorageCapacity(cluster, capacities); - /* restart all name nodes */ - cluster.restartNameNodes(); - cluster.waitActive(); - verifyStorageCapacity(cluster, capacities); + /* restart all name nodes */ + cluster.restartNameNodes(); + cluster.waitActive(); + verifyStorageCapacity(cluster, capacities); - /* restart all name nodes firstly and data nodes then */ - cluster.restartNameNodes(); - cluster.restartDataNodes(); - cluster.waitActive(); - verifyStorageCapacity(cluster, capacities); + /* restart all name nodes firstly and data nodes then */ + cluster.restartNameNodes(); + cluster.restartDataNodes(); + cluster.waitActive(); + verifyStorageCapacity(cluster, capacities); - /* restart all data nodes firstly and name nodes then */ - cluster.restartDataNodes(); - cluster.restartNameNodes(); - cluster.waitActive(); - verifyStorageCapacity(cluster, capacities); + /* restart all data nodes firstly and name nodes then */ + cluster.restartDataNodes(); + cluster.restartNameNodes(); + cluster.waitActive(); + verifyStorageCapacity(cluster, capacities); + } finally { + if (cluster != null) { + cluster.shutdown(); + } + } } private void verifyStorageCapacity(