Repository: hadoop Updated Branches: refs/heads/trunk c75cfa29c -> 31b627b2a
YARN-3580. [JDK8] TestClientRMService.testGetLabelsToNodes fails. Contributed by Robert Kanter. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/31b627b2 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/31b627b2 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/31b627b2 Branch: refs/heads/trunk Commit: 31b627b2a8755dec0820d01f6f7ac96e4c6194e2 Parents: c75cfa2 Author: Junping Du <[email protected]> Authored: Wed May 6 16:49:16 2015 -0700 Committer: Junping Du <[email protected]> Committed: Wed May 6 16:51:05 2015 -0700 ---------------------------------------------------------------------- hadoop-yarn-project/CHANGES.txt | 3 ++ .../resourcemanager/TestClientRMService.java | 45 ++++++++++---------- 2 files changed, 25 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/31b627b2/hadoop-yarn-project/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index dea4482..81180b5 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -316,6 +316,9 @@ Release 2.8.0 - UNRELEASED timeout. (Rohith Sharmaks via jianhe) YARN-3582. NPE in WebAppProxyServlet. (jian he via xgong) + + YARN-3580. [JDK8] TestClientRMService.testGetLabelsToNodes fails. (Robert Kanter + via junping_du) Release 2.7.1 - UNRELEASED http://git-wip-us.apache.org/repos/asf/hadoop/blob/31b627b2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java index 7be982b..a39f94f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java @@ -1410,9 +1410,11 @@ public class TestClientRMService { RMNodeLabelsManager labelsMgr = rm.getRMContext().getNodeLabelManager(); labelsMgr.addToCluserNodeLabelsWithDefaultExclusivity(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.put(NodeId.newInstance("host1", 0), ImmutableSet.of("x")); - map.put(NodeId.newInstance("host2", 0), ImmutableSet.of("y")); + map.put(node1, ImmutableSet.of("x")); + map.put(node2, ImmutableSet.of("y")); labelsMgr.replaceLabelsOnNode(map); // Create a client. @@ -1435,12 +1437,9 @@ public class TestClientRMService { client.getNodeToLabels(GetNodesToLabelsRequest.newInstance()); Map<NodeId, Set<String>> nodeToLabels = response1.getNodeToLabels(); Assert.assertTrue(nodeToLabels.keySet().containsAll( - Arrays.asList(NodeId.newInstance("host1", 0), - NodeId.newInstance("host2", 0)))); - Assert.assertTrue(nodeToLabels.get(NodeId.newInstance("host1", 0)) - .containsAll(Arrays.asList("x"))); - Assert.assertTrue(nodeToLabels.get(NodeId.newInstance("host2", 0)) - .containsAll(Arrays.asList("y"))); + Arrays.asList(node1, node2))); + Assert.assertTrue(nodeToLabels.get(node1).containsAll(Arrays.asList("x"))); + Assert.assertTrue(nodeToLabels.get(node2).containsAll(Arrays.asList("y"))); rpc.stopProxy(client, conf); rm.close(); @@ -1460,12 +1459,17 @@ public class TestClientRMService { RMNodeLabelsManager labelsMgr = rm.getRMContext().getNodeLabelManager(); labelsMgr.addToCluserNodeLabelsWithDefaultExclusivity(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.put(NodeId.newInstance("host1", 0), ImmutableSet.of("x")); - map.put(NodeId.newInstance("host1", 1), ImmutableSet.of("z")); - map.put(NodeId.newInstance("host2", 0), ImmutableSet.of("y")); - map.put(NodeId.newInstance("host3", 0), ImmutableSet.of("y")); - map.put(NodeId.newInstance("host3", 1), ImmutableSet.of("z")); + map.put(node1A, ImmutableSet.of("x")); + map.put(node1B, ImmutableSet.of("z")); + map.put(node2A, ImmutableSet.of("y")); + map.put(node3A, ImmutableSet.of("y")); + map.put(node3B, ImmutableSet.of("z")); labelsMgr.replaceLabelsOnNode(map); // Create a client. @@ -1491,14 +1495,11 @@ public class TestClientRMService { Assert.assertTrue( labelsToNodes.keySet().containsAll(Arrays.asList("x", "y", "z"))); Assert.assertTrue( - labelsToNodes.get("x").containsAll(Arrays.asList( - NodeId.newInstance("host1", 0)))); + labelsToNodes.get("x").containsAll(Arrays.asList(node1A))); Assert.assertTrue( - labelsToNodes.get("y").containsAll(Arrays.asList( - NodeId.newInstance("host2", 0), NodeId.newInstance("host3", 0)))); + labelsToNodes.get("y").containsAll(Arrays.asList(node2A, node3A))); Assert.assertTrue( - labelsToNodes.get("z").containsAll(Arrays.asList( - NodeId.newInstance("host1", 1), NodeId.newInstance("host3", 1)))); + labelsToNodes.get("z").containsAll(Arrays.asList(node1B, node3B))); // Get labels to nodes mapping for specific labels Set<String> setlabels = @@ -1509,11 +1510,9 @@ public class TestClientRMService { Assert.assertTrue( labelsToNodes.keySet().containsAll(Arrays.asList("x", "z"))); Assert.assertTrue( - labelsToNodes.get("x").containsAll(Arrays.asList( - NodeId.newInstance("host1", 0)))); + labelsToNodes.get("x").containsAll(Arrays.asList(node1A))); Assert.assertTrue( - labelsToNodes.get("z").containsAll(Arrays.asList( - NodeId.newInstance("host1", 1), NodeId.newInstance("host3", 1)))); + labelsToNodes.get("z").containsAll(Arrays.asList(node1B, node3B))); Assert.assertEquals(labelsToNodes.get("y"), null); rpc.stopProxy(client, conf);
