xiaoyuyao commented on a change in pull request #1120: HDDS-1822. NPE in 
SCMCommonPolicy.chooseDatanodes
URL: https://github.com/apache/hadoop/pull/1120#discussion_r305009712
 
 

 ##########
 File path: 
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/TestContainerPlacementFactory.java
 ##########
 @@ -75,50 +69,25 @@ public void setup() {
       // Totally 3 racks, each has 5 datanodes
       DatanodeDetails node = TestUtils.createDatanodeDetails(
           hostname + i, rack + (i / 5));
-      datanodes.add(node);
       cluster.add(node);
     }
 
     // create mock node manager
-    nodeManager = Mockito.mock(NodeManager.class);
-    when(nodeManager.getNodes(NodeState.HEALTHY))
-        .thenReturn(new ArrayList<>(datanodes));
-    when(nodeManager.getNodeStat(anyObject()))
-        .thenReturn(new SCMNodeMetric(storageCapacity, 0L, 100L));
-    when(nodeManager.getNodeStat(datanodes.get(2)))
-        .thenReturn(new SCMNodeMetric(storageCapacity, 90L, 10L));
-    when(nodeManager.getNodeStat(datanodes.get(3)))
-        .thenReturn(new SCMNodeMetric(storageCapacity, 80L, 20L));
-    when(nodeManager.getNodeStat(datanodes.get(4)))
-        .thenReturn(new SCMNodeMetric(storageCapacity, 70L, 30L));
-  }
-
+    NodeManager nodeManager = Mockito.mock(NodeManager.class);
 
-  @Test
-  public void testDefaultPolicy() throws IOException {
     ContainerPlacementPolicy policy = ContainerPlacementPolicyFactory
         .getPolicy(conf, nodeManager, cluster, true);
-
 
 Review comment:
   Thanks for reporting and fixing this. The fix LGTM. Can we move the 
rackaware test case into a separate test with policy class specified explicitly 
instead of removing them?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to