Skip to content

Commit 92ebd46

Browse files
author
Inigo Goiri
committed
HDFS-13551. TestMiniDFSCluster#testClusterSetStorageCapacity does not shut down cluster. Contributed by Anbang Hu.
1 parent 07d8505 commit 92ebd46

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestMiniDFSCluster.java

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,29 +108,35 @@ public void testClusterSetStorageCapacity() throws Throwable {
108108
capacities,
109109
defaultBlockSize,
110110
fileLen);
111-
verifyStorageCapacity(cluster, capacities);
111+
try {
112+
verifyStorageCapacity(cluster, capacities);
112113

113-
/* restart all data nodes */
114-
cluster.restartDataNodes();
115-
cluster.waitActive();
116-
verifyStorageCapacity(cluster, capacities);
114+
/* restart all data nodes */
115+
cluster.restartDataNodes();
116+
cluster.waitActive();
117+
verifyStorageCapacity(cluster, capacities);
117118

118-
/* restart all name nodes */
119-
cluster.restartNameNodes();
120-
cluster.waitActive();
121-
verifyStorageCapacity(cluster, capacities);
119+
/* restart all name nodes */
120+
cluster.restartNameNodes();
121+
cluster.waitActive();
122+
verifyStorageCapacity(cluster, capacities);
122123

123-
/* restart all name nodes firstly and data nodes then */
124-
cluster.restartNameNodes();
125-
cluster.restartDataNodes();
126-
cluster.waitActive();
127-
verifyStorageCapacity(cluster, capacities);
124+
/* restart all name nodes firstly and data nodes then */
125+
cluster.restartNameNodes();
126+
cluster.restartDataNodes();
127+
cluster.waitActive();
128+
verifyStorageCapacity(cluster, capacities);
128129

129-
/* restart all data nodes firstly and name nodes then */
130-
cluster.restartDataNodes();
131-
cluster.restartNameNodes();
132-
cluster.waitActive();
133-
verifyStorageCapacity(cluster, capacities);
130+
/* restart all data nodes firstly and name nodes then */
131+
cluster.restartDataNodes();
132+
cluster.restartNameNodes();
133+
cluster.waitActive();
134+
verifyStorageCapacity(cluster, capacities);
135+
} finally {
136+
if (cluster != null) {
137+
cluster.shutdown();
138+
}
139+
}
134140
}
135141

136142
private void verifyStorageCapacity(

0 commit comments

Comments
 (0)