Skip to content

Commit 454de3b

Browse files
author
Inigo Goiri
committed
HDFS-13559. TestBlockScanner does not close TestContext properly. Contributed by Anbang Hu.
1 parent be53969 commit 454de3b

File tree

1 file changed

+4
-1
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode

1 file changed

+4
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockScanner.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public void close() throws IOException {
125125
if (cluster != null) {
126126
for (int i = 0; i < numNameServices; i++) {
127127
dfs[i].delete(new Path("/test"), true);
128+
dfs[i].close();
128129
}
129130
cluster.shutdown();
130131
}
@@ -817,6 +818,7 @@ public Boolean get() {
817818
"in recentSuspectBlocks.", info.goodBlocks.contains(first));
818819
info.blocksScanned = 0;
819820
}
821+
ctx.close();
820822
}
821823

822824
/**
@@ -873,6 +875,7 @@ public Boolean get() {
873875
info.blocksScanned = 0;
874876
}
875877
info.sem.release(1);
878+
ctx.close();
876879
}
877880

878881
/**
@@ -933,12 +936,12 @@ public void testAppendWhileScanning() throws Exception {
933936
os.write(bytes);
934937
os.hflush();
935938
os.close();
936-
fs.close();
937939

938940
// verify that volume scanner does not find bad blocks after append.
939941
waitForRescan(info, numExpectedBlocks);
940942

941943
GenericTestUtils.setLogLevel(DataNode.LOG, Level.INFO);
944+
ctx.close();
942945
}
943946

944947
private void waitForRescan(final TestScanResultHandler.Info info,

0 commit comments

Comments
 (0)