HDFS-4275. MiniDFSCluster-based tests fail on Windows due to failure to delete test namenode directory. Contributed by Chris Nauroth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1422278 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2012-12-15 15:50:52 +00:00
parent 8aee71d1bc
commit 3363c45d69
2 changed files with 7 additions and 1 deletions

View File

@ -283,6 +283,9 @@ Trunk (Unreleased)
HDFS-4274. BlockPoolSliceScanner does not close verification log during
shutdown. (Chris Nauroth via suresh)
HDFS-4275. MiniDFSCluster-based tests fail on Windows due to failure
to delete test namenode directory. (Chris Nauroth via suresh)
Release 2.0.3-alpha - Unreleased
INCOMPATIBLE CHANGES

View File

@ -97,6 +97,7 @@ public class TestBlockRecovery {
MiniDFSCluster.getBaseDirectory() + "data";
private DataNode dn;
private Configuration conf;
private boolean tearDownDone;
private final static long RECOVERY_ID = 3000L;
private final static String CLUSTER_ID = "testClusterID";
private final static String POOL_ID = "BP-TEST";
@ -121,6 +122,7 @@ public class TestBlockRecovery {
*/
@Before
public void startUp() throws IOException {
tearDownDone = false;
conf = new HdfsConfiguration();
conf.set(DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY, DATA_DIR);
conf.set(DFSConfigKeys.DFS_DATANODE_ADDRESS_KEY, "0.0.0.0:0");
@ -177,7 +179,7 @@ DatanodeProtocolClientSideTranslatorPB connectToNN(
*/
@After
public void tearDown() throws IOException {
if (dn != null) {
if (!tearDownDone && dn != null) {
try {
dn.shutdown();
} catch(Exception e) {
@ -188,6 +190,7 @@ public void tearDown() throws IOException {
Assert.assertTrue(
"Cannot delete data-node dirs", FileUtil.fullyDelete(dir));
}
tearDownDone = true;
}
}