ChenSammi commented on code in PR #5362:
URL: https://github.com/apache/ozone/pull/5362#discussion_r1357734593


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/TestSCMContainerPlacementRackAware.java:
##########
@@ -797,4 +797,44 @@ public void testNoFallbackWithUsedNodes(int datanodeCount) 
{
     Assertions.assertTrue(tryCount >= 1, "Not enough try count");
     Assertions.assertEquals(0, compromiseCount);
   }
+
+  @Test
+  public void chooseNodeWithUsedAndFavouredNodesMultipleRack()
+      throws SCMException {
+    int datanodeCount = 12;
+    setup(datanodeCount);
+    int nodeNum = 1;
+    List<DatanodeDetails> usedNodes = new ArrayList<>();
+    List<DatanodeDetails> favouredNodes = new ArrayList<>();
+
+    // 2 replica
+    usedNodes.add(datanodes.get(0));
+    usedNodes.add(datanodes.get(1));
+    // 1 favoured node
+    favouredNodes.add(datanodes.get(2));
+
+    List<DatanodeDetails> datanodeDetails = policy.chooseDatanodes(usedNodes,
+        null, favouredNodes, nodeNum, 0, 5);
+
+    Assertions.assertEquals(nodeNum, datanodeDetails.size());
+    // Favoured node should not be returned,
+    // as favoured node is in the same rack as both used nodes.
+    Assertions.assertFalse(favouredNodes.get(0).getUuid() ==

Review Comment:
   Can it change to check that the returned node is not under the same rack as 
favouredNode? 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to