YARN-3580. [JDK8] TestClientRMService.testGetLabelsToNodes fails. Contributed by Robert Kanter.

(cherry picked from commit 31b627b2a8)

Conflicts:
	hadoop-yarn-project/CHANGES.txt
This commit is contained in:
Junping Du 2015-05-06 16:49:16 -07:00 committed by Tsuyoshi Ozawa
parent ceefabc44a
commit da564ef9a7
2 changed files with 25 additions and 23 deletions

View File

@ -103,6 +103,9 @@ Release 2.7.2 - UNRELEASED
YARN-4313. Race condition in MiniMRYarnCluster when getting history server YARN-4313. Race condition in MiniMRYarnCluster when getting history server
address. (Jian He via xgong) address. (Jian He via xgong)
YARN-3580. [JDK8] TestClientRMService.testGetLabelsToNodes fails. (Robert Kanter
via junping_du)
Release 2.7.1 - 2015-07-06 Release 2.7.1 - 2015-07-06
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -1409,9 +1409,11 @@ public class TestClientRMService {
RMNodeLabelsManager labelsMgr = rm.getRMContext().getNodeLabelManager(); RMNodeLabelsManager labelsMgr = rm.getRMContext().getNodeLabelManager();
labelsMgr.addToCluserNodeLabels(ImmutableSet.of("x", "y")); labelsMgr.addToCluserNodeLabels(ImmutableSet.of("x", "y"));
NodeId node1 = NodeId.newInstance("host1", 1234);
NodeId node2 = NodeId.newInstance("host2", 1234);
Map<NodeId, Set<String>> map = new HashMap<NodeId, Set<String>>(); Map<NodeId, Set<String>> map = new HashMap<NodeId, Set<String>>();
map.put(NodeId.newInstance("host1", 0), ImmutableSet.of("x")); map.put(node1, ImmutableSet.of("x"));
map.put(NodeId.newInstance("host2", 0), ImmutableSet.of("y")); map.put(node2, ImmutableSet.of("y"));
labelsMgr.replaceLabelsOnNode(map); labelsMgr.replaceLabelsOnNode(map);
// Create a client. // Create a client.
@ -1434,12 +1436,9 @@ public class TestClientRMService {
client.getNodeToLabels(GetNodesToLabelsRequest.newInstance()); client.getNodeToLabels(GetNodesToLabelsRequest.newInstance());
Map<NodeId, Set<String>> nodeToLabels = response1.getNodeToLabels(); Map<NodeId, Set<String>> nodeToLabels = response1.getNodeToLabels();
Assert.assertTrue(nodeToLabels.keySet().containsAll( Assert.assertTrue(nodeToLabels.keySet().containsAll(
Arrays.asList(NodeId.newInstance("host1", 0), Arrays.asList(node1, node2)));
NodeId.newInstance("host2", 0)))); Assert.assertTrue(nodeToLabels.get(node1).containsAll(Arrays.asList("x")));
Assert.assertTrue(nodeToLabels.get(NodeId.newInstance("host1", 0)) Assert.assertTrue(nodeToLabels.get(node2).containsAll(Arrays.asList("y")));
.containsAll(Arrays.asList("x")));
Assert.assertTrue(nodeToLabels.get(NodeId.newInstance("host2", 0))
.containsAll(Arrays.asList("y")));
rpc.stopProxy(client, conf); rpc.stopProxy(client, conf);
rm.close(); rm.close();
@ -1459,12 +1458,17 @@ public class TestClientRMService {
RMNodeLabelsManager labelsMgr = rm.getRMContext().getNodeLabelManager(); RMNodeLabelsManager labelsMgr = rm.getRMContext().getNodeLabelManager();
labelsMgr.addToCluserNodeLabels(ImmutableSet.of("x", "y", "z")); labelsMgr.addToCluserNodeLabels(ImmutableSet.of("x", "y", "z"));
NodeId node1A = NodeId.newInstance("host1", 1234);
NodeId node1B = NodeId.newInstance("host1", 5678);
NodeId node2A = NodeId.newInstance("host2", 1234);
NodeId node3A = NodeId.newInstance("host3", 1234);
NodeId node3B = NodeId.newInstance("host3", 5678);
Map<NodeId, Set<String>> map = new HashMap<NodeId, Set<String>>(); Map<NodeId, Set<String>> map = new HashMap<NodeId, Set<String>>();
map.put(NodeId.newInstance("host1", 0), ImmutableSet.of("x")); map.put(node1A, ImmutableSet.of("x"));
map.put(NodeId.newInstance("host1", 1), ImmutableSet.of("z")); map.put(node1B, ImmutableSet.of("z"));
map.put(NodeId.newInstance("host2", 0), ImmutableSet.of("y")); map.put(node2A, ImmutableSet.of("y"));
map.put(NodeId.newInstance("host3", 0), ImmutableSet.of("y")); map.put(node3A, ImmutableSet.of("y"));
map.put(NodeId.newInstance("host3", 1), ImmutableSet.of("z")); map.put(node3B, ImmutableSet.of("z"));
labelsMgr.replaceLabelsOnNode(map); labelsMgr.replaceLabelsOnNode(map);
// Create a client. // Create a client.
@ -1489,14 +1493,11 @@ public class TestClientRMService {
Assert.assertTrue( Assert.assertTrue(
labelsToNodes.keySet().containsAll(Arrays.asList("x", "y", "z"))); labelsToNodes.keySet().containsAll(Arrays.asList("x", "y", "z")));
Assert.assertTrue( Assert.assertTrue(
labelsToNodes.get("x").containsAll(Arrays.asList( labelsToNodes.get("x").containsAll(Arrays.asList(node1A)));
NodeId.newInstance("host1", 0))));
Assert.assertTrue( Assert.assertTrue(
labelsToNodes.get("y").containsAll(Arrays.asList( labelsToNodes.get("y").containsAll(Arrays.asList(node2A, node3A)));
NodeId.newInstance("host2", 0), NodeId.newInstance("host3", 0))));
Assert.assertTrue( Assert.assertTrue(
labelsToNodes.get("z").containsAll(Arrays.asList( labelsToNodes.get("z").containsAll(Arrays.asList(node1B, node3B)));
NodeId.newInstance("host1", 1), NodeId.newInstance("host3", 1))));
// Get labels to nodes mapping for specific labels // Get labels to nodes mapping for specific labels
Set<String> setlabels = Set<String> setlabels =
@ -1507,11 +1508,9 @@ public class TestClientRMService {
Assert.assertTrue( Assert.assertTrue(
labelsToNodes.keySet().containsAll(Arrays.asList("x", "z"))); labelsToNodes.keySet().containsAll(Arrays.asList("x", "z")));
Assert.assertTrue( Assert.assertTrue(
labelsToNodes.get("x").containsAll(Arrays.asList( labelsToNodes.get("x").containsAll(Arrays.asList(node1A)));
NodeId.newInstance("host1", 0))));
Assert.assertTrue( Assert.assertTrue(
labelsToNodes.get("z").containsAll(Arrays.asList( labelsToNodes.get("z").containsAll(Arrays.asList(node1B, node3B)));
NodeId.newInstance("host1", 1), NodeId.newInstance("host3", 1))));
Assert.assertEquals(labelsToNodes.get("y"), null); Assert.assertEquals(labelsToNodes.get("y"), null);
rpc.stopProxy(client, conf); rpc.stopProxy(client, conf);