HDFS-3129. NetworkTopology: add test that getLeaf should check for invalid topologies. Contributed by Colin Patrick McCabe
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1305628 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1650a49993
commit
99a321419f
|
@ -282,6 +282,9 @@ Release 0.23.3 - UNRELEASED
|
|||
HADOOP-8159. NetworkTopology: getLeaf should check for invalid topologies.
|
||||
(Colin Patrick McCabe via eli)
|
||||
|
||||
HDFS-3129. NetworkTopology: add test that getLeaf should check for
|
||||
invalid topologies (Colin Patrick McCabe via eli)
|
||||
|
||||
HADOOP-8204. TestHealthMonitor fails occasionally (todd)
|
||||
|
||||
BREAKDOWN OF HADOOP-7454 SUBTASKS
|
||||
|
|
|
@ -58,6 +58,25 @@ public class TestNetworkTopology extends TestCase {
|
|||
assertEquals(cluster.getNumOfLeaves(), dataNodes.length);
|
||||
}
|
||||
|
||||
public void testCreateInvalidTopology() throws Exception {
|
||||
NetworkTopology invalCluster = new NetworkTopology();
|
||||
DatanodeDescriptor invalDataNodes[] = new DatanodeDescriptor[] {
|
||||
new DatanodeDescriptor(new DatanodeID("h1:5020"), "/d1/r1"),
|
||||
new DatanodeDescriptor(new DatanodeID("h2:5020"), "/d1/r1"),
|
||||
new DatanodeDescriptor(new DatanodeID("h3:5020"), "/d1")
|
||||
};
|
||||
invalCluster.add(invalDataNodes[0]);
|
||||
invalCluster.add(invalDataNodes[1]);
|
||||
try {
|
||||
invalCluster.add(invalDataNodes[2]);
|
||||
fail("expected InvalidTopologyException");
|
||||
} catch (NetworkTopology.InvalidTopologyException e) {
|
||||
assertEquals(e.getMessage(), "Invalid network topology. " +
|
||||
"You cannot have a rack and a non-rack node at the same " +
|
||||
"level of the network topology.");
|
||||
}
|
||||
}
|
||||
|
||||
public void testRacks() throws Exception {
|
||||
assertEquals(cluster.getNumOfRacks(), 3);
|
||||
assertTrue(cluster.isOnSameRack(dataNodes[0], dataNodes[1]));
|
||||
|
|
Loading…
Reference in New Issue