HDFS-13554. TestDatanodeRegistration#testForcedRegistration does not shut down cluster. Contributed by Anbang Hu.
This commit is contained in:
parent
d45a0b7d73
commit
65476458fa
|
@ -330,8 +330,9 @@ public class TestDatanodeRegistration {
|
|||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_HANDLER_COUNT_KEY, 4);
|
||||
conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, Integer.MAX_VALUE);
|
||||
|
||||
final MiniDFSCluster cluster =
|
||||
new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
|
||||
MiniDFSCluster cluster = null;
|
||||
try {
|
||||
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
|
||||
cluster.waitActive();
|
||||
cluster.getHttpUri(0);
|
||||
FSNamesystem fsn = cluster.getNamesystem();
|
||||
|
@ -366,14 +367,15 @@ public class TestDatanodeRegistration {
|
|||
assertTrue(dnd.isRegistered());
|
||||
assertSame(lastReg, dn.getDNRegistrationForBP(bpId));
|
||||
|
||||
// check that block report is not processed and registration didn't change.
|
||||
// check that block report is not processed and registration didn't
|
||||
// change.
|
||||
dnd.setForceRegistration(true);
|
||||
assertFalse(waitForBlockReport(dn, dnd));
|
||||
assertFalse(dnd.isRegistered());
|
||||
assertSame(lastReg, dn.getDNRegistrationForBP(bpId));
|
||||
|
||||
// heartbeat should trigger re-registration, and next block report should
|
||||
// not change registration.
|
||||
// heartbeat should trigger re-registration, and next block report
|
||||
// should not change registration.
|
||||
waitForHeartbeat(dn, dnd);
|
||||
assertTrue(dnd.isRegistered());
|
||||
newReg = dn.getDNRegistrationForBP(bpId);
|
||||
|
@ -410,6 +412,11 @@ public class TestDatanodeRegistration {
|
|||
waitForHeartbeat(dn, dnd);
|
||||
assertTrue(dnd.isRegistered());
|
||||
assertNotSame(lastReg, dn.getDNRegistrationForBP(bpId));
|
||||
} finally {
|
||||
if (cluster != null) {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void waitForHeartbeat(final DataNode dn, final DatanodeDescriptor dnd)
|
||||
|
|
Loading…
Reference in New Issue