jojochuang commented on code in PR #10648:
URL: https://github.com/apache/ozone/pull/10648#discussion_r3574814792


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/TestSCMContainerPlacementRackScatter.java:
##########
@@ -900,6 +919,34 @@ public void testAllNodesOnRackExcludedReducesRackCount2()
     assertEquals(1, chosenNodes.size());
   }
 
+  /**
+   * Within a single rack holding an emptier and a fuller datanode, the intra
+   * rack selection should prefer the less utilized node instead of choosing
+   * uniformly at random.
+   */
+  @Test
+  public void chooseNodeWithinRackPrefersLessUtilized() throws SCMException {
+    // Single rack with two datanodes.
+    setup(2, 2);
+    updateStorageInDatanode(0, 10, 90);   // emptier node
+    updateStorageInDatanode(1, 90, 10);   // fuller node
+
+    Map<DatanodeDetails, Integer> selectedCount = new HashMap<>();
+    selectedCount.put(datanodes.get(0), 0);
+    selectedCount.put(datanodes.get(1), 0);
+
+    for (int i = 0; i < 1000; i++) {

Review Comment:
   A thousand times seems too much for a simple test. For the sake of saving 
test run time, let's just run it 100 times:
   
   ```suggestion
       for (int i = 0; i < 100; i++) {
   ```



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