Copilot commented on code in PR #10339:
URL: https://github.com/apache/ozone/pull/10339#discussion_r3293566526


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestSCMCommonPlacementPolicy.java:
##########
@@ -566,6 +566,46 @@ public void testValidatePlacementWithDeadMaintenanceNode() 
throws NodeNotFoundEx
     assertTrue(placementStatus.isPolicySatisfied());
   }
 
+  /**
+   * HDDS-15350: when the network topology transiently reports zero racks
+   * (observed during a DN decommission), validateContainerPlacement must
+   * not crash with ArithmeticException ("/ by zero") in
+   * getMaxReplicasPerRack. Without the fix this test throws and SCM's
+   * ReplicationMonitor thread dies along with it.
+   */
+  @Test
+  public void testValidateContainerPlacementWithZeroRackTopology() {
+    List<DatanodeDetails> nodes = ImmutableList.of(
+        MockDatanodeDetails.randomDatanodeDetails(),
+        MockDatanodeDetails.randomDatanodeDetails(),
+        MockDatanodeDetails.randomDatanodeDetails());
+    NodeManager mockNodeManager = mock(NodeManager.class);
+    when(mockNodeManager.getAllNodes()).thenAnswer(inv -> nodes);
+
+    // Topology that reports zero racks at the rack level - the empty
+    // -topology window observed during DN decommission.

Review Comment:
   This comment is split across lines in a way that reads as "empty" followed 
by "-topology" on the next line. Consider rewriting it as "empty-topology 
window" on one line (or rewrapping without the leading hyphen) to avoid 
confusion.
   



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